Skip to content

Instantly share code, notes, and snippets.

@oliversd
Created January 6, 2019 17:53
Show Gist options
  • Save oliversd/463fcbe7f0fd04e9add87b7d0709878d to your computer and use it in GitHub Desktop.
Save oliversd/463fcbe7f0fd04e9add87b7d0709878d to your computer and use it in GitHub Desktop.
let first = [1,2,3];
let second = [4,5,6];
// If we do this
first.push(second);
// We get
console.log(first); // [1,2,3,[4,5,6]] that is not right
// Using the spread operator
first.push(…second);
console.log(first); // [1,2,3,4,5,6] that's what we wanted!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment