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 },
If you want them in the order of the array of string then
var result = []; kpis.map((item) => { const matchedObject = a.find( (option) => option.id === item ); result.push(matchedObject); });