This is a rookie question but I couldn't find the name / keyword for this kind of syntax that is widely used in describing input parameters formats. For example:
Request method aliases
For convenience aliases have been provided for all supported request methods.
axios.request(config)
axios.get(url[, config])
axios.delete(url[, config])
axios.head(url[, config])
axios.options(url[, config])
axios.post(url[, data[, config]])
axios.put(url[, data[, config]])
axios.patch(url[, data[, config]])
The syntax url[, config]
or url[, data[, config]]
just looks really strange and is not self explanatory. What is the name for this kind of syntax?
I've seen them widely used but not sure how to read them. I just need someone to point a direction and tell a keyword / name or two about this syntax.
Answering myself here in case anyone had the same confusion:
whatever goes in []
is optional. For example:
The expression of axios.get(url[, config])
means that:
axios.get(url)
is acceptable, and
axios.get(url, config)
is also acceptable.