New course! Every coder should learn Generative AI!
Try a free lesson0
Can someone help with this question? Loops in ECMAScript 6
Students need to score at least 70 points to pass an exam. The given program declares an array with results. Write a program to count and output to the console the number of students who pass the exam. Use a for...of loop to iterate through the array. let scores = [68,95,54,84,77,75,63,74,69,80,71,63] //your code goes here
2 Answers
+ 4
this is my solution:
let scores = [68,95,54,84,77,75,63,74,69,80,71,63]
//your code goes here
let pass =0;
for(let val of scores) {
if (val >= 70) {
pass ++
}
}
console.log(pass);