Skip to content
Advertisement

How to log how many possibilities fulfil the if statement javascript

JavaScript

I’m trying to log how many items from the array fulfil the condition. the output I’m looking for is : 6 (because 6 of the numbers are equal or greater than 8)

tried

let count = 0; for (let i = 0; i < grades.length; i++) {

if (grades[i]>= 8){ count++

JavaScript

}

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement