Created
April 28, 2013 09:33
-
-
Save jinlong/5476409 to your computer and use it in GitHub Desktop.
prototype 原型链的方法访问局部变量。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ClassA = function(){ | |
var a = 111; | |
this.b = 222; | |
this.show = function(){ | |
alert(a) | |
}; | |
}; | |
ClassA.prototype.constructor = ClassA; | |
ClassA.prototype.showme = function(){ | |
this.show(); | |
} | |
var aa = new ClassA(); | |
aa.showme(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment