I simply want to know how to return the indexes of the objects whose name property is equal to "Bob" using the filter method. (in this case one Index for simplicity)
data.json
[
{
"index": "14",
"name": "Bob",
"age": "23",
},
{
"index": "23",
"name": "John",
"age": "30",
},
{
"index": "17",
"name": "Bob",
"age": "25",
},
]
app.js
const data = require("./data.json");
const searchword = "Bob";
const result = data.filter((word) => ???word === searchword???);
console.log(result);
Should show index:14,17