user3513466
user3513466

Reputation: 1

nodeJS function documentation syntax

I'm slightly confused by the nodeJS documentation.

For instance, looking at the assert module I instantly see

assert(value[, message])

how exactly do I read this? I understand assert is a function that takes a parameter called value, but what exactly does [, message] mean? Does it mean message is an array? Why does the comma not come before the initial opening bracket?

Upvotes: 0

Views: 387

Answers (1)

ninekey
ninekey

Reputation: 11

The example you provide simply means that the parameter "message" is optional. The documentation states:

If value is not truthy, an AssertionError is thrown with a message property set equal to the value of the message parameter. If the message parameter is undefined, a default error message is assigned.

Upvotes: 1

Related Questions