As you can see, the first element in the first array is an empty string. I don’t need it in the output json. How to accomplish this using map/filter or for loop?
I’m a bit off topic, but is there any particular reason why you wouldn’t use map here?
I wrote variations with reduce and map, with for loops, and with just map. The Big O should be equivalent (or I’ve miscalculated it), and the readability of both the map and for loop versions seemed comparable to me (the reduce version feels a bit brutal).
Are there specific style/perf/cognitive complexity improvements you had in mind when leading the OP away from map (and filter)?