Skip to content

Tag: arrays

Split array data from fetch data

I fetch this data from the api then i want to split this into two array i try using split function but it didn’t work, when i check for array.length, console said it undefined. when i console.log(array) it show like this Help me please. Answer First, This is not an array it’s an object. You can us…

How to recalculate an object from a nested objects?

I have an object where Citems is an array of Object. Each object has status on or of and time. I want to generate an array or object from it that show total time for each status like below I tried with map and reduce but getting confused. Answer You just need a nested ‘sum’, here implemented using…