console.assert(value[, ...message])
console.assert() 会在 value 为 假值 或未提供时写入一条消息。它仅写入消息,不会以其他方式影响执行。输出总是以“Assertion failed”开头。如果提供,message 会使用 util.format() 进行格式化。
如果 value 是 真值,则不会发生任何事情。
【If value is truthy, nothing happens.】
console.assert(true, 'does nothing');
console.assert(false, 'Whoops %s work', 'didn\'t');
// Assertion failed: Whoops didn't work
console.assert();
// Assertion failed