Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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.
 
PREVIOUS NEXT
Tagged: #find #item #object #js
ADD COMMENT
Topic
Name
2+2 =