Once upon a time in a little village called Javascript, lived two brothers named Some and Every.
And one day ...
Seriously what do you think about ?
Some and Every are two powerful functions that can be used to ease a wide range of tasks. It is often used for operations such as filtering or finding a specified value within an array. Understanding the concepts behind these two functions is essential for all JavaScript developers.
In its simplest form, Some is a function that will take an array and a callback function as its parameters. The callback function should contain a test that is to be performed on each element within the array. If the test evaluates to true, then the whole expression evaluates to true. On the other hand, the Every function is identical to Some, but the difference is that it works within the context of an ‘all-or-nothing’ logic. This means that if all the tests evaluate to true, only then will the whole expression test to true.
To use some and every in practice, consider the following example.
Let’s pass an array of numbers to a function with the goal is to check whether all the values in the array are greater than twenty. A simple implemention of this using some could look like the following:

Notice how the function ‘isNumberGreaterThan20’ is used as a parameter for the Some function. This is known as a ‘callback function’, which is a function written specifically to be used as a parameter passed to another function. In this instance, it simply takes a value and checks if it is greater than twenty.
But, to use the Every function instead, the code would look almost identical with one minor tweak. The changes would look like the following:

This line changes the some function to an every function. As explained earlier, this will check if all the tests test to true, rather than any.
This is all about the lovely Story between Some and Every.
If you like this article, you can follow me along on social to be aware of new ones.