function clone(obj) {
    if (obj === null || typeof obj !== 'object' || 'isActiveClone' in obj) {
        return obj;
    }
    let temp = (obj instanceof Date || obj instanceof XMLHttpRequest) ? (new obj.constructor()) : obj.constructor();

    for (let key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
            obj['isActiveClone'] = null;
            temp[key] = clone(obj[key]);
            delete obj['isActiveClone'];
        }
    }
    return temp;
}
/**
 * Create a clone of an object
 *
 * @param {Object} obj The object that need to be clone
 * @returns {Object} True clone of given object
 */
Create a clone of an object

@param {Object} obj The object that need to be clone
@returns {Object} True clone of given object
Create a clone of an object @param { Object } obj The object that need to be clone @returns { Object } True clone of given object
function clone(obj) {
    if (obj === null || typeof obj !== 'object' || 'isActiveClone' in obj) {
        return obj;
    }
    let temp = (obj instanceof Date || obj instanceof XMLHttpRequest) ? (new obj.constructor()) : obj.constructor();
    for (let key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
            obj['isActiveClone'] = null;
            temp[key] = clone(obj[key]);
            delete obj['isActiveClone'];
        }
    }
    return temp;
}
function clone ( obj ) { if ( obj === null || typeof obj !== 'object' || 'isActiveClone' in obj ) { return obj ; } let temp = ( obj instanceof Date || obj instanceof XMLHttpRequest ) ? ( new obj . constructor ( ) ) : obj . constructor ( ) ; for ( let key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { obj [ 'isActiveClone' ] = null ; temp [ key ] = clone ( obj [ key ] ) ; delete obj [ 'isActiveClone' ] ; } } return temp ; }
Create a clone of an object
Create a clone of an object