153
rated 0 times
[
160]
[
7]
/ answers: 1 / hits: 16483
/ 7 Years ago, tue, october 31, 2017, 12:00:00
I have an array of objects and I want to update some of the content. I figured I could just map through the objects, find the match I was looking for and than update it.
data = data.map(obj => {
return this.state.objToFind === obj.title;
}).map(obj, idx) => {
console.log(found + obj.title); // reads found + undefined?
obj.menu = this.state.menu;
obj.title = this.state.title;
obj.content = this.state.content;
});
However, this is not working. I find the object but obj.anything is undefined. My console.log reads Found undefined.
More From » json