For next json
[ { "index": "xyz", ... }, { "index": "abc1234", ... }, { "index": "xyz", ... }, { "index": "abc5678", ... } ...
I want to filter abc values and xyz values separately.
I tried the following to get the values
var x = _.filter(jsonData, function (o) { return /abc/i.test(o.index); });
and he worked to give filtered outs.
Now I want to get the highest of abc values, if there are abc123 , abc444 , abc999 , then the code should return abc999 .
I can repeat the loop using lodash, but can this be done with a single call - in the same one that is being filtered out?
source share