摘要:
var a = {}; var b = a; var o = {}; o[a] = 1; o[b] = 2; o[a]++; console.log(o[b]); 阅读全文
摘要:
var closure = (function(){ var arr = [1, 3]; function printArr() { console.log(arr); }; return [arr, printArr]; }()); closure[1](); // [1, 3] closure[0][1] = 2; closure[1](... 阅读全文
摘要:
var closure = (function(){ var arr = [1, 3]; return { getA: (function() { return arr; }()), printArr: function() { console.log(arr); }... 阅读全文
摘要:
var closure = (function(){ var arr = [1, 3]; return { getA: function() { return arr; }, printArr: function() { console.log(arr); } ... 阅读全文
摘要:
如何判断 instanceof 返回真 只要判断右边的值是否是左边对象的构造函数或原型对象上的构造函数即可 // example var arr = []; 由于: 1. arr.constructor === Array 2. arr.__proto__ === Array.prototype 3. arr.__poto__.proto__ === Object.prototype 所... 阅读全文