0

I'm looking through the MDN web docs and have seen this parameters for Object

// Object initialiser or literal
{ [ nameValuePair1[, nameValuePair2[, ...nameValuePairN] ] ] }

However, I'm struggling to understand what I'm actually looking at, I know it's an object literal, but the bracket notation is throwing me

juicy89
  • 448
  • 5
  • 14
  • It means that the argument is optional and can contain an array with one or more elements of nameValuePair – dkasipovic Jul 23 '18 at 10:37
  • It doesn't mean object notation. It means the parameter is optional. – Nimeshka Srimal Jul 23 '18 at 10:39
  • Thanks, Understand this now. – juicy89 Jul 23 '18 at 10:42
  • Brackets `[]` mean the arguments are ***optional***. Comma `,` means they must be separated by commas. `NameValuePair` of an object literal is standard notation for Object properties in JavaScript. [Example](https://jsfiddle.net/d3krnyLf/) – tao Jul 23 '18 at 10:44

0 Answers0