Answers for "return all object with certain value in array"

CSS
4

get array of all property in object array

objArray = [ { foo: 1, bar: 2}, { foo: 3, bar: 4}, { foo: 5, bar: 6} ];
let result = objArray.map(a => a.foo); //[1,3,5]
//OR
let result = objArray.map(({ foo }) => foo) //[1,3,5]
Posted by: Guest on April-20-2021
3

js get all values of object

Object.values(object1)
Posted by: Guest on February-21-2020

Code answers related to "return all object with certain value in array"

Browse Popular Code Answers by Language