UNPKG

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