.clone()
Description
Parameters
Usage
original = [1,2,3]
copy = original.clone()
copy[1] = 10
log original[2] // 1 (unaffected)Last updated
Creates a deep copy of the array, duplicating all nested arrays and objects so that the returned copy shares no references with the original.
clone takes no parameters.
original = [1,2,3]
copy = original.clone()
copy[1] = 10
log original[2] // 1 (unaffected)Last updated