square bracket inside function definition

509 Views Asked by At

In the Node js Documentation, I have seen something like this,

fs.readFile(path[, options], callback)

What do those square brackets mean? I'm sorry if this is duplicate, but I wasn't able to find an answer.

1

There are 1 best solutions below

3
Snow On

It means that the parameter is optional. Call like

fs.readFile('some/path', options, callback)

or

fs.readFile('some/path', callback)

Related Questions in JAVASCRIPT

Related Questions in NODE.JS

Related Questions in ECMASCRIPT-6