Skip to content

Instantly share code, notes, and snippets.

@csdear
Created March 18, 2016 16:00
Show Gist options
  • Save csdear/9a6ff114763291848818 to your computer and use it in GitHub Desktop.
Save csdear/9a6ff114763291848818 to your computer and use it in GitHub Desktop.
Array - Clone Using the slice(0) method.
var fruits = ['banana', 'orange', 'apple', 'mango'];
>fruits
<["banana", "orange", "apple", "mango"]
>var fruitClone = fruits.slice(0);
>fruitClone
<["banana", "orange", "apple", "mango"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment