Skip to content

Instantly share code, notes, and snippets.

@moonformeli
Created November 9, 2019 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moonformeli/1dadab988f019bc4f7e4c0f419232754 to your computer and use it in GitHub Desktop.
Save moonformeli/1dadab988f019bc4f7e4c0f419232754 to your computer and use it in GitHub Desktop.
function breakingRecords(scores) {
let min = scores[0];
let max = scores[0];
var minCount = 0;
var maxCount = 0;
for (var i = 1; i < scores.length; i += 1) {
if (scores[i] > max) {
max = scores[i];
maxCount += 1;
}
if (scores[i] < min) {
min = scores[i];
minCount += 1;
}
}
return [maxCount, minCount];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment