Find if two arrays are repeated in array and then select them - Javascript Array Operation

Javascript examples for Array Operation:Array Search

Description

Find if two arrays are repeated in array and then select them

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(){//from   w  w  w. j  av a  2  s .co  m
var array = [[1, 17], [1, 17], [1, 17], [2, 12], [5, 9], [2, 12], [6, 2], [2, 12]];
let result = array.filter((r={},a=>!(2-(r[a]=++r[a]|0))))
document.body.innerHTML=JSON.stringify(result);
    }

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

Related Tutorials