JS Built-ins
consolebeginner

console β€” assert is a function

πŸ“– Usage Example
console.assert(1 === 1, 'Math works')   // no output
console.assert(1 === 2, 'This fails')   // β†’ Assertion failed: This fails

console.assert() logs an error message only when the condition is falsy.

console.assert()

console.assert(assertion, message) logs a message to console if the assertion is false. If the assertion is true, nothing happens.

Challenge: Verify that console.assert is a function.

πŸ’‘ Hints (1)
  • β€’ console.assert is a debugging tool that does not throw errors