0

As I'm going through the javascript documentation i seet that in syntax section i see that call([thisObj[, arg1[, arg2[, [, argN]]]]])

can any one explain why is this written [thisObj[ with open squire bracket starting and closed with open squire bracket.

Similarly arg1[, arg2[, [, argN]]]]]

Thanks in advance

Noushad Ali
  • 167
  • 1
  • 9

1 Answers1

1

It represents an optional argument.

i.e.

thisObj is optional.

arg1 is optional, but if you provide it then thisObj is mandatory.

arg2 is optional, but if you provide it then arg1 is mandatory.

…and then the [, argN] just means you can keep going for any number of arguments.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335