Calling a method without brackets for Prototype using prototype.__defineGetter__ - Javascript Object

Javascript examples for Object:prototype

Description

Calling a method without brackets for Prototype using prototype.__defineGetter__

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. java2s.c  om
   String.prototype.__defineGetter__("world", function() {
        return this + ' world';
   });
console.log("hello".world);
    });

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

Related Tutorials