DEV Community

Discussion on: Daily Challenge #16 - Number of People on the Bus

Collapse
 
abumostafa profile image
Ahmed Abumostafa

JS

const stops = [
 [10, 0],
 [5, 3],
 [4, 4],
 [3, 8],
 [0, 2],
]

const inBus = stops.reduce(
(n, [gotIn, gotOut]) => n + gotIn - gotOut,
0
)