Object.clone

Object.clone

Object.clone

Function

Returns a deep copy of the object.

Syntax

Parameters

No parameters.

Return value

TypeDescription
ObjectReturns the new object value.

Return object fields

The returned object contains all field names of the original object. Variable containers such as arrays, objects, and class instances will be copied recursively; non-ordinary containers such as functions, regular expressions, dates, and standard library objects maintain the original runtime semantics.

Example

Notes

  • clone does not modify the original object.