Filter an object array based on the property - Javascript Array

Javascript examples for Array:map

Description

Filter an object array based on the property

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 someObjArray = [{lastname:"foo", firstname:"bar", grade:10, userId:"foobar1234"}]
console.log(someObjArray.map(s => s.userId));
    }

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

Related Tutorials