Array push and then show its content - Javascript Array

Javascript examples for Array:push

Description

Array push and then show its content

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 ww  .ja  v  a2  s.c om
var value = [];
for (var i = 1; i <= 300; i++) {
    value.push(i);
    display(value);
}
function display(msg) {
    var p = document.createElement('p');
    p.innerHTML = msg;
    document.body.appendChild(p);
}
    });

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

Related Tutorials