In my nested array setup, it appears as follows:
let scores = [
[[2, 1, 0], [2, 1, 0]],
[[4, 2, 0]],
[[4, 2, 0]],
[[4, 2, 0],[2, 1, 0]]
]
The main goal here is to identify the highest value in each sub-array (while summing up the highest values in arrays that contain multiple arrays, such as within the first array, [[2,1,0],[2,1,0]], where we need to add up the highest values of each array resulting in 2+2.)
One approach I'm considering is to either use shift() on the initial value of each array OR utilize slice()/remove to extract the lower values. This would transform my current array into this format:
newScores = [[[2],[2]], [4], [4], [[4],[2]]]
Ultimately, what I aim to achieve is represented by: output = [[4], [4], [4], [6]]
I am hopeful for some guidance in this matter! Thank you!