Spread And Rest


… (dot dot dot) basically is just a concat, you can enter and exit a function with …args

var User = function(...args) {
  // ...args is now an array
  return args;
var args = User(1,2,3,4,5);  
console.log(args); // [1,2,3,4,5]
console.log(args[0]); // 1
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License