[Solved] Correctly build a filter function without DRY issue

Do you mean:

{
"index":0,
"id":"marker_0",
"title":"Title One",
"cat":"food"
},
{
"index":1,		
"id":"marker_1",
"title":"Title Two",
"cat":"food"
},
...

And how do we fit the forEach into our existing code?

I was also wondering, with the current code above, what loops through the json data? I mean, if we use forEach we know instantly what is happening, though above what is doing the iteration inside the function?

Main reason I ask is because I’ve been using each, forEach, Object.keys, etc and none of these are being used within the function. And would I be right in saying the functions just mentioned create an index automatically?

Cheers, Barry