Calling function without brackets via variable - Javascript Function

Javascript examples for Function:Function Call

Description

Calling function without brackets via variable

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   www  . j  a v a 2  s.c  o  m*/
var a = function () {
    console.log(0);
};
document.getElementById('btn').onclick = a
    }

      </script> 
   </head> 
   <body> 
      <input value="click" type="button" id="btn">  
   </body>
</html>

Related Tutorials