Answers for "find and get value in object array javascript"

2

find item in object js

const object1 = {
  a: {val: "aa"},
  b: {val: "bb"},
  c: {val: "cc"}
};

let a = Object.values(object1).find((obj) => {
	return obj.val == "bb"
});
console.log(a)
//Object { val: "bb" }
//Use this for finding an item inside an object.
Posted by: Guest on May-10-2021
7

javascript find object in array

myArray.findIndex(x => x.id === '45');
Posted by: Guest on September-15-2020

Code answers related to "find and get value in object array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language