freeCodeCamp/guide/english/javascript/es6/every-function/index.md

17 lines
413 B
Markdown
Raw Normal View History

---
title: Every Function
---
# Every Function in ES6
Every function returns true or false if a given array passes the criteria.
```
let number = [1, 2, -1, -3, 0];
number.every((value) => value >= 0 );
```
Would give the result true if the array has a value 0 or greater than 0.
For more information, please visit https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every