So I have a 2d array containing multiple objects. Each object has multiple properties and methods. I would like to return only the objects methods and properties that have a matching id to what I pass it. in this case, the id is 1.
const blogData = [
{
title : "Title 1",
date : "2017-07-15",
id : 1
},
{
title : "Title 2",
data : "2017-07-16",
id : 2
}
];
for (let i = 0; i < blogData.length; i++) {
if (blogData[i].id === 1) {
console.log(`Post #${blogData[i].id} loaded`);
}
}