Skip to content

Instantly share code, notes, and snippets.

@atomize
Created September 23, 2017 19:03
Show Gist options
  • Save atomize/6d13c56db68c102ae227464e94ec5d34 to your computer and use it in GitHub Desktop.
Save atomize/6d13c56db68c102ae227464e94ec5d34 to your computer and use it in GitHub Desktop.
Example of concatenating arrays using spread syntax in pure Javascript.
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