You Can Use Console.Assert To Print Out An Assertion To The Console

TopicSource
๐Ÿ–ฅ๏ธ TechTips 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");

  1. Use console.table to print out huge objects into the console
  2. Use console.dir for logging html elements