s/self/this in JavaScript

This commit is contained in:
Jakub Jurových 2013-07-12 21:14:52 +02:00
parent 50444ed21f
commit 94ef913f98

View File

@ -364,7 +364,7 @@ myObj.meaningOfLife // = 43
// are given when they're created with that constructor and the new keyword. // are given when they're created with that constructor and the new keyword.
myConstructor.prototype = { myConstructor.prototype = {
getMyNumber: function(){ getMyNumber: function(){
return self.myNumber return this.myNumber
} }
} }
var myNewObj2 = new myConstructor() var myNewObj2 = new myConstructor()