标签:
You can use number as function/variable name, the numberic name can‘t be accessed from parent scope, but can be accessed by ‘this‘ in private scope.
var o= { attr1:‘value of attr1‘, 1:‘private attr ,the index is 1‘, 301:function(){ console.log(‘private function , name is 2‘); }, fun1:function(){ console.log(this[1]); this[301].call(this); } }; o.fun1();
To add private variable to this Javascript literal object
标签:
原文地址:http://www.cnblogs.com/zyip/p/4341717.html