Javascript examples for Array Operation:Array Element
Call function from an array one by one
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//from w ww . ja v a 2 s . c o m var funcs = [ function () { console.log('1'); }, function () { console.log('2'); }, function () { console.log('3'); } ]; var currentFunc = funcs.shift(); while (currentFunc) { currentFunc(); currentFunc = funcs.shift(); } }); </script> </head> <body> </body> </html>