javascript拷贝创建对象

​
/*拷贝创建对象*/
function hightExtend() {
    var key = 0, i = 0, len = arguments.length;
    target = null;
    if (len == 0) {
        return false;
    } else if (len == 1) {
        return arguments[0];
    } else {
        i++;
        target = arguments[0];
        for (; i < len; i++) {
            for (key in arguments[i]) {
                target[key] = arguments[i][key];//把后面传入的对象遍历一下,但遍历每一个对象的属性
                //添加到target元素上
            }
        }
    }
}
​

  

原文地址:https://www.cnblogs.com/itlyh/p/6045767.html