QP School
JavaScript - The filter() method - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: JavaScript Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=6)
+--- Thread: JavaScript - The filter() method (/showthread.php?tid=4085)



JavaScript - The filter() method - Qomplainerz - 04-04-2023

Code:
const ages =
      [
        32,
        33,
        16,
        40
      ];

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

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