-1

Using this page as an example, I want to understand entirely the syntax MDN uses here:

enter image description here

I know that things in brackets are 'optional'.
Does ...argN generally mean unlimited amount of arguments?
Why are the brackets and commas written on the wrong side of each other? Wouldn't it be better if it were just:
func.call([thisArg], [arg1], [arg2], [...argN])?

tonitone120
  • 1,920
  • 3
  • 8
  • 25

1 Answers1

0

No, an optional number of parameters are usually written as [arg1, arg2, ...argN]. You are not passing a number of parameters which have distinct valid values (to disambiguate) and are all optional.

Toothbrush
  • 2,080
  • 24
  • 33