clone.md (802B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function clone 4 5 Clone an object. Will make a deep copy of the data. 6 7 8 ## Syntax 9 10 ```js 11 math.clone(x) 12 ``` 13 14 ### Parameters 15 16 Parameter | Type | Description 17 --------- | ---- | ----------- 18 `x` | * | Object to be cloned 19 20 ### Returns 21 22 Type | Description 23 ---- | ----------- 24 * | A clone of object x 25 26 27 ### Throws 28 29 Type | Description 30 ---- | ----------- 31 32 33 ## Examples 34 35 ```js 36 math.clone(3.5) // returns number 3.5 37 math.clone(math.complex('2-4i') // returns Complex 2 - 4i 38 math.clone(math.unit(45, 'deg')) // returns Unit 45 deg 39 math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]] 40 math.clone("hello world") // returns string "hello world" 41 ``` 42 43