[TIP] console assert for javascript debugging tip!
Discussion

Have you ever found yourself using or seeing stuff like:

if (!$parameters.result){

console.log("Debug")

//or

console.error("Error")

on your web/mobile apps?


Here's a nice alternative for these "if wrappers":

console.assert($parameters.result, "Debug")

console.assert will output a message if the assertion resolves to false

Just a nice way to have a clear intention for these things.


See: https://developer.mozilla.org/en-US/docs/Web/API/console/assert

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.