Calling functions in Object.Prototype from Object - Javascript Object

Javascript examples for Object:prototype

Description

Calling functions in Object.Prototype from Object

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() {/*  w  ww . j av a 2  s . com*/
Object.prototype.func = function() { console.log('hi there'); }

Function.func();
String.func();
Number.func();
'A string'.func();
Boolean.func();
true.func();
Object.func();

    });

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

Related Tutorials