Parse array into a new array - Javascript Array Operation

Javascript examples for Array Operation:Array Element

Description

Parse array into a new array

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  w  w  .j  a va 2s. c o  m*/
var oldArray = [
    {number: '1', alphabet: 'abcde'},
    {number: '5', alphabet: 'abcde'},
    {number: '6', alphabet: 'abcde'},
    {number: '9', alphabet: 'abcde'},
]
var newNumberArray = oldArray.map(function(item){
    return item.number;
});
console.log(newNumberArray);
    }

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

Related Tutorials