Skip to content

Instantly share code, notes, and snippets.

@Nasah-Kuma
Created September 19, 2022 12:44
Show Gist options
  • Save Nasah-Kuma/eaf9463aec254114e4f29f877e0a81c0 to your computer and use it in GitHub Desktop.
Save Nasah-Kuma/eaf9463aec254114e4f29f877e0a81c0 to your computer and use it in GitHub Desktop.
function breakingRecords(scores) {
// Write your code here
let [min, max] = [0, 0];
let minScore = scores[0];
let maxScore = scores[0];
for(let i = 1; i < scores.length; i++) {
if (scores[i] < minScore) {
min++;
minScore = scores[i];
} else if(scores[i] > maxScore) {
max++;
maxScore = scores[i];
}
}
return[max, min];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment