• + 0 comments

    Solution using JavaScript:

    function breakingRecords(scores) { let maxCount = 0; let minCount = 0; let highScore = scores[0]; let lowScore = scores[0];

    for(let i = 1; i < scores.length; i++) {
        if(scores[i] > highScore) {
            maxCount = maxCount + 1;
            highScore = scores[i];
        } 
        if(scores[i] < lowScore) {
            minCount = minCount + 1;
            lowScore = scores[i];
        }
    }
    return [maxCount, minCount];
    

    }

    let scores1 = [3, 4, 21, 36, 10, 28, 35, 5, 24, 42]; console.log(breakingRecords(scores1));