QP School

Full Version: JavaScript - The filter() method
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
const ages =
      [
        32,
        33,
        16,
        40
      ];

function checkAdult(ages)
{
  return ages >= 18;
}

document.getElementById("demo").innerHTML = ages.filter(checkAdult);