Relative Content

Tag Archive for javascriptreactjsarraysjsonloops

loop through array of objects and get result in [key values] format

I have an array of objects as shown below. As you can see, each object with name Engineering, Environment and others has its radars object. this radars object has all object in it and it should have p1, p2, p3+ and ‘totalin it. if any of this is missing, that means its count is 0. for e.g. withEnvironment, the p1, and p2` are missing. that means it count is 0 and so on.

iterate array of objects and get result in object key values format

I have an array of objects as shown below. As you can see, each object with name Engineering, Environment and others has its radars object. this radars object has all object in it and it should have p1, p2, p3+ and ‘totalin it. if any of this is missing, that means its count is 0. for e.g. withEnvironment, the p1, and p2` are missing. that means it count is 0 and so on.