Answers for "nodejs get all the ids from array"

0

get all id from array of objects javascript

function getFields(input, field) {
    var output = [];
    for (var i=0; i < input.length ; ++i)
        output.push(input[i][field]);
    return output;
}

var result = getFields(objArray, "foo"); // returns [ 1, 3, 5 ]
Posted by: Guest on January-21-2021
0

javascript get all elements of an id

// You can't
// You can only have 1 instance of an id per document
// You need to use classes instead

var x = document.getElementsByClassName("example");
Posted by: Guest on November-07-2020

Code answers related to "nodejs get all the ids from array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language