Execute an array of functions - Javascript jQuery

Javascript examples for jQuery:Array

Description

Execute an array of functions

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from w  w w .j  a  v  a  2  s. co m*/
var functionsArray = [oct12,oct13,oct14];
$(functionsArray).each(function(key, val){
 val();
});
function oct12(){
    console.log('oct12');
}
function oct13(){
    console.log('oct13');
}
function oct14(){
    console.log('oct14');
}
    });

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

Related Tutorials