Remove array values with condition, less than and greater than - Javascript Array

Javascript examples for Array:filter

Description

Remove array values with condition, less than and greater than

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//w ww . j a  va  2 s.  c o  m
var arr = [
    1,2,8,6,4,3,2,8,3,11,13,12,13,12,32,14,16,15,120
]
var new_arr = arr.filter(function(x) {
    return x > 12 && x < 13;
});
console.log(new_arr)
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials