repl.it
@isreal/

test-scores-eval-question-3

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Write a function that accepts an array of test scores as an
// argument. The function should return the number of test scores that
// were an 80 or higher.
function countScores(scores){
  // get scores 80 or higher
  const higherScores = scores.filter(function(score) {
    return score >= 80;
  });

  // return number of scores
  return higherScores.length;
}

let scores = [80, 81, 83, 72, 78];
console.log(countScores(scores));
 
Native Browser JavaScript
?