Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the square brackets in function syntax mean on MDN? [duplicate]

Tags:

javascript

MDN uses:

JSON.stringify(value[, replacer [, space]])

instead of just this:

JSON.stringify(value, replacer, space)

What do the square brackets mean?

like image 827
Saravana Avatar asked Sep 30 '13 08:09

Saravana


People also ask

What are square brackets in function syntax represent?

Square brackets are used to index (access) elements in arrays and also Strings. Specifically lost[i] will evaluate to the ith item in the array named lost.

What do square brackets mean in JavaScript?

What do square brackets mean in JS? The [] operator converts the expression inside the square brackets to a string. For instance, if it is a numeric value, JavaScript converts it to a string and then uses that string as the property name, similar to the square bracket notation of objects to access their properties.


1 Answers

It's a conventional way in technical documentation of saying that part is optional.

like image 148
Itay Avatar answered Oct 01 '22 00:10

Itay