1

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Oh that makes. So in an example like assert.doesNotThrow(block[, error][, message]) it just means error and message are both optional?
Yes. Both parameters "error" and "message" are optional when using the doesNotThrow assertion.
Where can I find documentation about this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.