Access Value of "this" in Object constructor function - Javascript Object

Javascript examples for Object:Constructor

Description

Access Value of "this" in Object constructor function

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
console.clear();
var APP = function(name){/* w ww.java  2 s . com*/
        this.appName = name
};
APP.prototype.test = function(){
        console.log(this.appName)
}
var app = new APP("test")
var testing = app.test.bind(app);
app.test();
testing();

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

Related Tutorials