Use array.shift() to popup element from array - Javascript Array

Javascript examples for Array:shift

Description

Use array.shift() to popup element from 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(){/*from w ww .j  av  a  2s . c o  m*/
var a = [];
a.push(function(){
 console.log("a");
});
a.push(function(){
 console.log("b");
});
a.shift()(); //alerts a
a.shift()(); //alerts b
    }

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

Related Tutorials