I wonder if there is a more elegant way of doing this. Suppose i have an array of objects like this:
a = [ { \"id\": \"kpi02\", \"value\": 10 },
You can use indexOf in filter, like this
var res = a.filter(function (el) { return kpis.indexOf(el.id) >= 0; });
Example