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

https://www.w3schools.com/jsref/jsref_some.asp

Example

<!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>

Last updated