• + 0 comments

    Solution in JS

    function breakingRecords(scores) {
        let lowestScore = scores[0]
        let highestScore = scores[0]
        let highestScoreBeatenCount = 0;
        let lowestScoreBeatenCount = 0;
        for (let i = 0; i< scores.length; i++){
               if(scores[i] > highestScore){
                    highestScoreBeatenCount+=1
                    highestScore = scores[i]
               }else if (scores[i] < lowestScore){
                    lowestScoreBeatenCount+=1
                    lowestScore = scores[i]
               }
        }
        return [highestScoreBeatenCount,lowestScoreBeatenCount ]
    }