javascript闭包[两个小测试例子]
<script>var name = "The Window";var Object_a = { name : "My Object", getNameFunc : function(){ return function(){ return this.name; }; }};alert(Object_a.getNameFunc()());</script>
?
结果:The Window
发布时间: 2013-03-14 10:33:15 作者: rapoo
javascript闭包[两个小测试例子]
<script>var name = "The Window";var Object_a = { name : "My Object", getNameFunc : function(){ return function(){ return this.name; }; }};alert(Object_a.getNameFunc()());</script>
?
结果:The Window