# JavaScript Array some() method returns true (and stops) if the function returns true() (ok)

### Example&#x20;

```html
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Arrays</h2>
<p>The Array.some() method checks if any of the elements in an array pass a test (provided as a function).</p>
<p id="demo"></p>
<script>
const ages = [3, 10, 18, 20];
const abc = ages.some((age) => {
    console.log(age);
    return age > 8;
});
console.log(abc);
</script>
</body>
</html>

```

<figure><img src="https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M1E4Gk2ppVKb4olmnun%2Fuploads%2FnwSbOXuR28iT8vKJSOHC%2Fimage.png?alt=media&#x26;token=2206e67b-b66d-46fd-b670-5ebcf93ea858" alt=""><figcaption></figcaption></figure>
