Js array traversal

var obj = [
{"id":" 152", "name":" file test"},
{"id":" 23", "name":" file test"},
{"id":" 23", "name":" file test"};
]
how to traverse the value of id to form an array
to get an array

Mar.16,2022

var newArr=[];
for(var i=0; i<obj.length; iPP){
    if(obj[i].id) newArr.push(obj[i].id);
}
console.log(newArr)

the oldest way to write


map was

 obj.map(v=>v.id);
Menu