invoke a function from array of function values - Javascript Array Operation

Javascript examples for Array Operation:Array Element

Description

invoke a function from array of function values

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 ww  w  .  j  a va  2s.  com*/
 var puzzlers = [
       function ( a ) { return 8*a - 110; },
       function ( a ) { return (a-3) * (a-13) * (a-3); },
       function ( a ) { return a * a + 41; },
       function ( a ) { return a % 2; }
     ];
console.log(puzzlers[0](9));
    }

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

Related Tutorials