Skip to content

Instantly share code, notes, and snippets.

View binnng's full-sized avatar
🎯
Focusing

binnng binnng

🎯
Focusing
View GitHub Profile
@jinlong
jinlong / globalVal
Created April 28, 2013 09:07
用 this 定义的方法可以访问局部变量 a,在 prototype 里定义的方法不能访问局部变量 a; 用 this 定义的方法,在 prototype 上定义的方法均可以访问全局变量 b;
var ClassA = function(){
var a = 111;
this.b = 222;
this.show = function(){
alert(this.b)
}
};
ClassA.prototype.constructor = ClassA;
ClassA.prototype.showme = function(){
alert(this.b)
[
{
name:"HTML5",
uri:"http://www.w3.org/TR/html5/single-page.html",
category:"markup"
},
{
name:"HTML 5.1",
uri:"http://www.w3.org/TR/html51/single-page.html",
category:"markup"