1myObj = {
2 policy: {
3 index: 1,
4 page: "/policy"
5 },
6 purchase: {
7 index: 2,
8 page: "/purchase"
9 }
10}
11
12// get value on key
13Object.keys(myObj).forEach(key => {
14 if (myObj[key].index === 2) {
15 console.log("Found.");
16 }
17});
18
19// If you want to stop the search when one was found
20Object.keys(myObj).some(key => myObj[key].index === 2);