You Can Use Console.Assert To Print Out An Assertion To The Console
Topic | Source |
---|---|
๐ฅ๏ธ Tech | Tips and Tricks for Debugging JavaScript - YouTube |
Instead of using console.log
, you can print out an assertion with console.assert
. The first parameter is the assertion and the second one is the message you want to print as an error (similar to console.error
, if the assertion failed.
console.assert(value !== undefined, "This shouldn't be undefined");