JS Built-ins
consolebeginner

console β€” assert(false) returns undefined (no throw)

πŸ“– Usage Example
console.assert(false, 'Always fails')  // β†’ Assertion failed: Always fails

Passing false as the condition always triggers the assertion message.

console.assert() β€” false assertion

When console.assert(assertion) is called with a false assertion, a message is logged (to console error), but it does NOT throw an exception. It returns undefined.

Challenge: Verify that console.assert(false, 'msg') returns undefined and does not throw.

πŸ’‘ Hints (1)
  • β€’ console.assert does not throw exceptions β€” it only logs messages