Calling a function from variable value - Javascript Function

Javascript examples for Function:Function Call

Description

Calling a function from variable value

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 a v  a2  s. co m*/
var app = {
    alert : function(message){
       console.log(message)
    }
}
var funcName = "alert";
app[funcName]('this is a message');


    }

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

Related Tutorials