Function cloneDeep

  • This method is like clone except that it recursively clones value. Object inheritance is preserved.

    Type Parameters

    • T

    Parameters

    • value: T

      The value to recursively clone.

    Returns T

    Returns the deep cloned value.

    5.3.0

    clone

    const objects = [{ 'a': 1 }, { 'b': 2 }]

    const deep = cloneDeep(objects)
    console.log(deep[0] === objects[0])
    // => false