Mixed Copy of an Object in JavaScript

function mixedCopy() {
    var i, j, newObj = {};
    for(i = 0; i < arguments.length; i++) {
        for(j in arguments[i]) {
            if(arguments[i].hasOwnProperty(j)) {
                newObj[j] = arguments[i][j];
            }
        }
    }
    return newObj;
}

Copy from any number of objects and mix them all into a new object.

Add your comment