标签:blog io ar 使用 java strong div on log
消除代码全局变量名占用: //本质是使用匿名函数;
void function(x, y, z) { console.log(x + y + z); }(1,2,3);
//要使函数内的变量不被释放,需要使用引用;
一次性的构造函数: //维护原型链,保证标识符重写后,实例.constructor仍指向构造器;
var Instance = function() {}; Instance.prototype = { constructor: Instance } Instance = new Instance(); Instance2 = new Instance.constructor();
对象充当识别器:
标签:blog io ar 使用 java strong div on log
原文地址:http://www.cnblogs.com/jinkspeng/p/4094767.html