Created
March 18, 2016 16:00
-
-
Save csdear/9a6ff114763291848818 to your computer and use it in GitHub Desktop.
Array - Clone
Using the slice(0) method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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