<html>
<body>
<p>Click the button to check if any of the elements in the array has a value of 18 or more.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
var ages = [3, 10, 18, 20];
function checkAdult(age) {
return age >= 18;
}
function myFunction() {
document.getElementById("demo").innerHTML = ages.some(checkAdult);
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_some by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:01:27 GMT -->
</html>