Sometimes we need to check if all of the elements in an array meet a given condition, in this situation we can use the method to test if all of the elements satisfy this condition. In the following example, we use this method to test if all of the numbers of an array are greater than 10. In this example with have two different arrays with numbers and we use the method to check if all the numbers are greater than 10. All the numbers in the first array are greater than 10 so the callback function returns , while the second one does not satisfy this condition so the callback function returns . How does the Javascript every method work? The method of Javascript is an iteration method that allows you to check if all the elements of an array meet a specific condition, the callback function that receives this method iterates over the array and checks if the element meets the condition, if it does the function returns , otherwise it returns , if all the elements in the array meet the condition then the method returns but if any of the elements does not meet the condition then immediately the function returns for example: This code checks if all of the elements in the arrays are numbers , because in the first array, all the elements are effectively numbers the Javascript method iterates through the entire array to check if each element fulfills the condition, but in the second array some of the elements are strings and when the method check that an element does not meet the condition it returns false immediately it doesn´t check the rest of the elements. Syntax of the every method in Javascript The Javascript method receives two parameters: : the first parameter is the callback function that checks each element in the array ( REQUIRE ). This callback function receives three parameters: : is the current element of the array on each iteration ( REQUIRE ). : is the index of the current element on each iteration ( OPTIONAL ). : is the array on which the method is invoked ( OPTIONAL ). : the second parameter is an object that you can specify to be used as the value of in the callback function. It allows you to access properties inside the object of the callback function ( OPTIONAL ). Is important to know that this second parameter can only be used if you pass a regular function as a callback to the method if you use an arrow function the this property cannot be accessed inside the callback function like is shown in the following example. ( output ) of the code: In this example, the first call of the method uses a regular function and therefore it can print in the console the value of the object, but the second call of this method uses an arrow function and because you cannot access the object inside an arrow function it print in the console undefined . This is an example of how to access these parameters. In this example, we show in the console all the values of the different parameters as well as the value of the object , then we check if all of the numbers inside the array are greater than the initial value that we assigned to the object in the property minValue . Use cases of the every() method in Javascript The array method in Javascript can be used on many different occasions, it can be used to check even or odd numbers, check user credentials, check the type of the data, and many other things. We'll see some useful use case scenarios in the next examples. 1. Checking if all the numbers are even One of the most common uses of this method is to check if all the numbers in an array are even or odd. Here we have two different arrays and we want to check if all the numbers inside them are even numbers, to do so we use the module operator or remainder operator and the syntax , if the remainder of the number divided by 2 is 0 this means that the number is an even number but if the if remainder is a different number for example this means that the number is an odd number . 2. Checking the type of the data Another way that you can use the Javascript method is to check the type of the data of an array. In this example, we use the method of Javascript to check if all the elements in the arrays are strings , the first array has the names of 4 different fruits so it returns because all of the elements are effectively strings , but the second array does not meet this condition so it returns . 3. Checking a user form input Another useful use of the method in Javascript is to check if a form has been filled in correctly. HTML Code: JavaScript Code: In this example, we use the method to check if a form has been filled in correctly. First, we have to create an HTML file with a form inside the body and three inputs, and a button inside the form, then, we create a Javascript file, and inside of it, we implement two different event handlers. The first event handler is the function onChange where we store the values of the inputs in the constant userInputs . The second event handler is the onSubmit function where first we check if all t