标签:
var name = "The Window"; function aaa(){ this.name = "My Object"; this.getNameFunc = function(){ return name; } } function bbb(){ this.name = "My Object"; this.getNameFunc = function(){ return this.name; } } function ccc(){ this.name = "My Object"; this.getNameFunc = function(){ return function(){ return this.name; }; } } function ddd(){ this.name = "My Object"; this.getNameFunc = function(){ return function(){ return name; }; } } var object = { name : "My Object", getNameFunc : function(){ return function(){ return this.name; }; } var a = new aaa(); var b = new bbb(); var c = new ccc(); var d = new ddd(); a.getNameFunc(); b.getNameFunc(); c.getNameFunc()(); d.getNameFunc()(); object.getNameFunc()()
求输出~
标签:
原文地址:http://my.oschina.net/u/867090/blog/408240