Remove specified element from associated array with filter method - Javascript Array Operation

Javascript examples for Array Operation:Associative Array

Description

Remove specified element from associated array with filter method

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  a  v a  2 s .co m*/
 var storeData3 = [
  { 'key' : 'value1' },
  { 'key' : 'value2' },
  { 'key' : 'value3' },
  { 'key' : null },
  { 'key' : '' },
  { 'key' : 'value10'}
];
var result = storeData3.filter(function(val, _){return (val.key !== '' && val.key !== null)});
console.log(result);
    }

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

Related Tutorials