Articles → JAVASCRIPT → Array filter function in JavaScript

Array filter function in JavaScript






Purpose





Example




<html>
   <head>
   </head>
   <body>
      <script>
         var arr = [12, 15, 21, 23];
         
         console.log(arr.filter(FilterArray));
         
         function FilterArray(arr) {
             return arr > 14;
         }
         
      </script>
   </body>
</html>



Output


Picture showing the output of Array filter function in JavaScript

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, August 26, 2021

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250