About Pi Downloads Documentation Plugins Developer Forum Issues

Array.clone

Summary

Duplicates the array.

Syntax

Array.clone(shallow (Optional))
  • Undeep is a required boolean value indicating whether the clone is a shallow clone or not

Example

>>> var a = [3,5,[7]];
>>> a.clone();
[3,5,[7]];
>>> var b = a.clone();
>>> b[0]=9;
>>> b[2].push("hello");
>>> b
[9,5,[7,"Helllo"]]
>>> a
[3,5,[7]];

See Also