0

I have functionWithManyArguments(arg1,...,arg15).

Can I log all arguments without having to enumerate them all?

Santa Clauze
  • 163
  • 1
  • 17

1 Answers1

0

Yes, You could do something like:-

function foo(...args) {
  console.log(...args);
}
foo(1, 2, "a")

...args are rest parameters.

vibhor1997a
  • 2,336
  • 2
  • 17
  • 37
  • Unfortunately, I need to name all the arguments because every one of them are used in some logic. The reason why I need to use all of them at once is because I want to test if all args are defined else it returns an error. – Santa Clauze Nov 28 '18 at 19:54