function Demo(name) { this.name = name; }var getSingle = function(fn) { var result; return function() { console.log(arguments.length); return result || (result = fn.apply(this, arguments)); } };const aa = new getSingle(Demo)('a');const bb = new getSingle(Demo)('b');console.log(aa === bb); //trueconsole.log(aa.name); // TypeError: aa is undefinedconsole.log(bb); // undefined
为什么aa.name
和bb
未定义呢?
慕村225694
相关分类