Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Created January 23, 2016 08:49
Show Gist options
  • Save StevenJL/7131eeee5edd99607656 to your computer and use it in GitHub Desktop.
Save StevenJL/7131eeee5edd99607656 to your computer and use it in GitHub Desktop.
var smallArray = [2,3,4]
var bigArray = [1, ...smallArray, 5, 6, 7] // [1, 2, 3, 4, 5, 6, 7]
// You can use it in function arguments
var foo = function(a,b,c){ return a+b+c; }
var args = [1,2,3]
foo(...args)
// like Ruby's splat, no?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment