Monday, February 5, 2018

Do a .some off of an array in JavaScript to see if any one item in the array meets a particular condition for scenarios in which a Boolean value should be based on at least one match. has this example:

var ages = [3, 10, 18, 20];
function checkAdult(age) {
   return age >= 18;
function myFunction() {
   document.getElementById("demo").innerHTML = ages.some(checkAdult);

No comments:

Post a Comment