1 |
|
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 | ## Examples
|
28 |
|
29 | ```js
|
30 | math.clone(3.5) // returns number 3.5
|
31 | math.clone(math.complex('2-4i') // returns Complex 2 - 4i
|
32 | math.clone(math.unit(45, 'deg')) // returns Unit 45 deg
|
33 | math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]]
|
34 | math.clone("hello world") // returns string "hello world"
|
35 | ```
|
36 |
|
37 |
|