Created
September 23, 2017 19:03
-
-
Save atomize/6d13c56db68c102ae227464e94ec5d34 to your computer and use it in GitHub Desktop.
Example of concatenating arrays using spread syntax in pure Javascript.
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 arr1 = [0, 1, 2]; | |
var arr2 = [3, 4, 5]; | |
arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2] | |
// source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment