--- id: 587d7dab367417b2b2512b6e title: Use the every Method to Check that Every Element in an Array Meets a Criteria challengeType: 1 videoUrl: '' localeTitle: Use o método Every para verificar se todos os elementos em uma matriz atendem a um critério --- ## Description
O método every funciona com arrays para verificar se cada elemento passa por um teste específico. Retorna um valor booleano - true se todos os valores atendem aos critérios, false se não. Por exemplo, o código a seguir verificaria se cada elemento na matriz de numbers é menor que 10:
números var = [1, 5, 8, 0, 10, 11];
numbers.every (function (currentValue) {
return currentValue <10;
});
// Retorna falso
## Instructions
Use o método every dentro da função checkPositive para verificar se todos os elementos em arr são positivos. A função deve retornar um valor booleano.
## Tests
```yml tests: - text: Seu código deve usar o método every . testString: 'assert(code.match(/\.every/g), "Your code should use the every method.");' - text: 'checkPositive([1, 2, 3, -4, 5]) deve retornar false .' testString: 'assert(!checkPositive([1, 2, 3, -4, 5]), "checkPositive([1, 2, 3, -4, 5]) should return false.");' - text: 'checkPositive([1, 2, 3, 4, 5]) deve retornar true .' testString: 'assert(checkPositive([1, 2, 3, 4, 5]), "checkPositive([1, 2, 3, 4, 5]) should return true.");' - text: 'checkPositive([1, -2, 3, -4, 5]) deve retornar false .' testString: 'assert(!checkPositive([1, -2, 3, -4, 5]), "checkPositive([1, -2, 3, -4, 5]) should return false.");' ```
## Challenge Seed
```js function checkPositive(arr) { // Add your code below this line // Add your code above this line } checkPositive([1, 2, 3, -4, 5]); ```
## Solution
```js // solution required ```