I do not understand what all these brackets mean in MDN javascript syntax document.
For example, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/G
These brackets mean optional parameters. It means, you don't have to include those parameters.
Example: Lets say I have function for incrementing: inc(x)
Which needs one parameter. When called, it will increment that variable exactly by one. inc(x)
equals x++
But I would like to have an option to increment by any number as well. Eg.: inx(x, 3)
which gives the same result as x = x + 3
. Then I can describe my function similarly as on MDN as:
function inc(variable [,increment])