JS Array Filter

 
<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    var ages = [10, 12, 19, 20];
	document.write(ages + "<br><br>");
	var b = ages.filter(checkAdult);
	document.write(b + "<br>");

	function checkAdult(age) {
		return age >= 18;
	}
  </script>
</head>
<body>
</body>
</html>