2018-10-12 15:37:13 -04:00
---
title: Use the some Method to Check that Any Elements in an Array Meet a Criteria
---
2019-07-24 00:59:27 -07:00
# Use the some Method to Check that Any Elements in an Array Meet a Criteria
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
---
## Problem Explanation
2018-10-12 15:37:13 -04:00
Use the some method inside the checkPositive function to check if any element in arr is positive. The `checkPositive` function should return a Boolean value.
2019-07-24 00:59:27 -07:00
#### Relevant Links
2018-10-12 15:37:13 -04:00
- [Array.prototype.some() ](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some )
2019-07-24 00:59:27 -07:00
---
## Solutions
< details > < summary > Solution 1 (Click to Show/Hide)< / summary >
2018-10-12 15:37:13 -04:00
```javascript
function checkPositive(arr) {
2019-07-24 00:59:27 -07:00
return arr.some(elem => elem > 0);
2018-10-12 15:37:13 -04:00
}
checkPositive([1, 2, 3, -4, 5]);
```
2019-07-24 00:59:27 -07:00
< / details >