Created
January 25, 2017 08:58
-
-
Save davismj/c26c1567127dac71c859dfeadc966606 to your computer and use it in GitHub Desktop.
Spread example.
This file contains 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
a = [1,2,3] // [1, 2, 3] | |
b = [4,5] // [4, 5] | |
c = a.slice() // [1, 2, 3] | |
c.push(b) // 4 | |
JSON.stringify(c) // "[1,2,3,[4,5]]" | |
JSON.stringify([...a, ...b]) // "[1,2,3,4,5]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment