Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

codewars js Number of People in the Bus

var number = function (busStops) {
    let totalPpl = 0
    for (let i = 0; i < busStops.length; i++) {
        let currStop = busStops[i]
        let getOn = currStop[0]
        let getOff = currStop[1]
        totalPpl += getOn;
        totalPpl -= getOff;
    }
    return totalPpl;
}
 
PREVIOUS NEXT
Tagged: #codewars #js #Number #People #Bus
ADD COMMENT
Topic
Name
6+5 =