Tuesday, 2 October 2018

node.js: console.assert(value[, ...message])

console.assert(value[, ...message])
If the value is evaluated to false, then the message is logged. If the value is evaluated to true, nothing will happen.

HelloWorld.js
/* This message is not logged */
console.assert((10 == 10), "%d is equal to %d", 10, 10);

/* This message is logged */
console.assert((10 == 11), "%d is not equal to %d", 10, 11);


Output
Assertion failed: 10 is not equal to 11



Previous                                                 Next                                                 Home

No comments:

Post a Comment