Answers for "return an array of strings from an array of objects js"

1

return an array of strings from an array of objects js

var items = [{
  id: 1,
  name: 'AAA'
}, {
  id: 2,
  name: 'BBB'
}, {
  id: 3,
  name: 'CCC'
}];

var names = items.map(function(item) {
  return item['name'];
});

console.log(names);
console.log(items);
Posted by: Guest on June-12-2020

Code answers related to "return an array of strings from an array of objects js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language