Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JavaScript - The filter() method
#1
Code:
const ages =
      [
        32,
        33,
        16,
        40
      ];

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

document.getElementById("demo").innerHTML = ages.filter(checkAdult);
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  JavaScript Array fill() method examples Qomplainerz 0 427 04-04-2023, 07:41 AM
Last Post: Qomplainerz
  JavaScript - The find() method Qomplainerz 0 400 04-04-2023, 07:40 AM
Last Post: Qomplainerz
  Filter tables with JQuery Qomplainerz 0 392 04-04-2023, 07:10 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 4 Guest(s)