Return values in multiple arrays - Javascript Array Operation

Javascript examples for Array Operation:Array Element

Description

Return values in multiple arrays

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
  var products = [//from   w w w.j  a  v a 2 s .  c  o m
      ["A", 29.99],
      ["B", 19.99]
  ]
  var testArray = new Array();
  for (var i=0; i < products.length; i++){
      products[i].splice(0,0,'TEST');
      testArray.push(products[i]);
  }
  var json = JSON.stringify(testArray);
  console.log(testArray);

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

Related Tutorials