Javascript examples for Object:Object Context
Bind this context in object
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* w ww.j ava 2 s.c o m*/ var testObj = { name: "my object", logName: function() { console.log(this.name); var logNameAgain = function() { console.log(this.name); }.bind(this); logNameAgain(); } }; testObj.logName(); } </script> </head> <body> </body> </html>