Javascript examples for Array:map
Build arrays to show index number
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from www.j a v a 2 s . co m*/ var myArray = [12, 24, 36, 48, 60, 15, 30], newArray = myArray.map(function (value, index) { return [index + 1, value]; }); console.log(newArray); } </script> </head> <body> </body> </html>