2022-07-25 10:14:12 +02:00

48 lines
1.2 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-clone">Function clone <a href="#function-clone" title="Permalink">#</a></h1>
Clone an object. Will make a deep copy of the data.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.clone(x)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | * | Object to be cloned
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
* | A clone of object x
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
math.clone(3.5) // returns number 3.5
math.clone(math.complex('2-4i')) // returns Complex 2 - 4i
math.clone(math.unit(45, 'deg')) // returns Unit 45 deg
math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]]
math.clone("hello world") // returns string "hello world"
```