Asserts that a condition is true
断言条件为真
The condition to assert. 要断言的条件
Optional
The message to display if the condition is false. 如果条件为假时显示的消息
If the condition is false. 如果条件为假
assert(true) // no throwassert(false, 'custom message') // throws Error: custom message Copy
assert(true) // no throwassert(false, 'custom message') // throws Error: custom message
Asserts that a condition is true
断言条件为真