This article explains the array’s `some()``every()` and the `forEach()` method.

# The some() method

The `some()` method iterates through elements and checks if any value in the array satisfies a condition. The `some()` method accepts a boolean expression with the following signature:
`(element) => boolean`
where the element is the current element in the array whose value is being checked
boolean denotes that the function returns a boolean value
Consider the following array of integers:
`let arr = [1, 2, 3, 4, 5, 6, 7, 8];`
We will be using the some() method to check if at least one element is even in the array.
`arr.some((value)=> { return (value%2 == 0); });`
Output:
`true`
As the array contains elements divisible by 2, so the `some()` method returned `true`.
When tried some() method with the logic to find negative numbers
`arr.some((value)=> { return (value < 0); });`
The output is
`false`
As there are no numbers in the array that are negative.
The `some()` method stops iterating as soon as the element is found which satisfies the required boolean expression.
```arr.some((value) => {
index++;
console.log(index);
return (value % 2 == 0);
});```
Output is:
`1 2 true`

# The every() method

Opposing to `some()`, the `every()` method checks if each of the element in the array satisfies the boolean expression. If even a single value doesn't satisfy the element it returns `false`, else it returns `true`.
```let arr = [1, 2, 3, 4, 5, 6, 7, 8];arr.every((value)=> {
return (value > 0);
});```
Since all of the values in the array `arr` are positive, so the boolean expression satisfies for all of the values. We receive `true` as output.
With even a single value, not satisfying the boolean expression, we get the boolean output as `false`.
`arr.every((value)=> { return (value == 5); });`
Output:
`false`
The every() method stops iterating over the elements as soon as any value fails the boolean expression.
```arr.every((value) => {
index++;
console.log(index);
return (value != 4);
});```
Output:
`1 2 3 false`

# The forEach() method

The `forEach()` method, as the name suggests, is used to iterate over every element of the array and perform some desired operation with it.
```let arr = [1, 2, 3, 4, 5, 6, 7, 8];arr.forEach((value) => {
console.log(value == 5);
});```
We get the output as:
`false false false false true false false false`
Nothing different here, just iterating each element with some operation (as required) on it.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6708125,"math_prob":0.98129,"size":2446,"snap":"2019-35-2019-39","text_gpt3_token_len":621,"char_repetition_ratio":0.15970516,"word_repetition_ratio":0.045783132,"special_character_ratio":0.2845462,"punctuation_ratio":0.17068273,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99385226,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-08-17T23:47:53Z\",\"WARC-Record-ID\":\"<urn:uuid:e7446001-fb55-4db6-a751-f9661efaa8eb>\",\"Content-Length\":\"278432\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3bd19e75-f22f-4cfb-a5f1-e26184e85a25>\",\"WARC-Concurrent-To\":\"<urn:uuid:20bf4f08-eb37-4b28-9d0e-a78c352e1924>\",\"WARC-IP-Address\":\"172.217.164.147\",\"WARC-Target-URI\":\"https://www.knowledgescoops.com/2019/07/javascript-array-some-vs-every-vs.html\",\"WARC-Payload-Digest\":\"sha1:5QZHTCLPR72Z7MXGFBPZS5PVMHP5ASAY\",\"WARC-Block-Digest\":\"sha1:QPSPCELT2ZZ6VDDNDK5JKRHL42QYRITO\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-35/CC-MAIN-2019-35_segments_1566027313501.0_warc_CC-MAIN-20190817222907-20190818004907-00320.warc.gz\"}"}