Snippets Collections
function howMany(){
  console.log(arguments); // 
}


howMany(3,4,5,6,7,8,90,)



//prints
Arguments(7) [3, 4, 5, 6, 7, 8, 90, callee: (...), Symbol(Symbol.iterator): ƒ]
// shows an array and we can do something like



function howMany() {
  let total = 0;
  for (let value of arguments) {
    total += value;
  }
  console.log(total);
  return total;
}

howMany(3, 4, 5, 6, 7, 8, 90);
// bad
function concatenateAll() {
  const args = Array.prototype.slice.call(arguments);
  return args.join('');
}

// good
function concatenateAll(...args) {
  return args.join('');
}
star

Sun Aug 10 2025 02:46:40 GMT+0000 (Coordinated Universal Time)

#functional #args #arguments
star

Thu Aug 19 2021 17:41:31 GMT+0000 (Coordinated Universal Time) https://github.com/airbnb/javascript

#arguments #spread

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension