Using Console.Assert To Print Out An Assertion To The Console
[!INFO]-
topic: ๐ฅ๏ธ Tech
links:
- Use console.table to print out huge objects into the console
- Use console.dir for logging html elements
source: Tips and Tricks for Debugging JavaScript - YouTube
tags: #permanent-note #published
Last Modified:=dateformat(this.file.mtime, "MMM. dd, yyyy - HH:mm")
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");