Output array content with Json stringify() - Javascript JSon

Javascript examples for JSon:JSon String

Description

Output array content with Json stringify()

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(){//  www.j a  v a  2  s.co m
    var array1 = ["one","two","three"],
        array2 = ["1","2","3"],
        newarray = array1.map(function(c, i) { return [ c, array2[i] ] });
        console.log(JSON.stringify(newarray));
    }

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

Related Tutorials