0 day streak
javascript / beginner
Snippet

Checking Conditions with Array.some()

The .some() method checks if at least one element in an array passes the test implemented by the provided function. It returns a boolean.

snippet.js
javascript
1
2
const scores = [12, 45, 88, 30];
const hasPassingScore = scores.some(score => score >= 50);
nextjs
Breakdown
1
scores.some(score => score >= 50)
Returns true because 88 is greater than or equal to 50.