I have an array of objects
myArrayOfObjects = [
0: {
title: 'title 1',
ids: ['90b7f1804642', 'ffa339e9aed7']
},
1: {
title: 'test 2',
ids: ['99472a9cb432', 'ec3d70ea6ef8']
}
];
I want to check each of the values in ids array if they match an id I have outside. This is what I came up with:
myArrayOfObjects.forEach((item, index) => {
if(item.ids[index] === this.myId) {
console.log('SUCCESS');
}
})
But it does not go through all of the values in ids array. What is the appropriate way to solve this?
let myArrayOfObjects = [0: 'value']is not how you create arrays (you're also missing some quotes)