var createAssigner = function(keysFunc, undefinedOnly) {
return function(obj) {
var length = arguments.length;
if (length < 2 || obj == null) return obj;
for (var index = 1; index < length; index++) {
var source = arguments[index],
keys = keysFunc(source),
l = keys.length; //为什么这里要是1=keys.length??这样写是个什么意思?
for (var i = 0; i < l; i++) {
var key = keys[i];
if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
}
}
return obj;
};
};
1 回答
qq_邪风曲_0
TA贡献9条经验 获得超4个赞
嗯???搞不明白,难道这里l不是为了下面的for循环吗???
l = keys.length;
for (var i = 0; i < l; i++) {
添加回答
举报
0/150
提交
取消