Skip to main content
Console.assert - Web documentation
method Console.assert
Private
Console.assert(
condition?: boolean,
...data: any[],
): void

Tests that an expression is true. If not, logs an error message

Examples

Example 1

console.assert(1 === 1, "This won't show");
console.assert(1 === 2, "This will show an error");

Parameters

optional
condition: boolean

The expression to test for truthiness

...data: any[]

Return Type

void
Back to top