Easy Tutorial
❮ Prop Frame Longdesc Obj History ❯

HTML DOM console.assert() Method

Console Object

Example

If the first argument is false, output information to the console:


Definition and Usage

The console.assert() method outputs information to the console if the first argument is false.


Syntax

console.assert(expression, message)

Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
console.assert() Yes Yes 28 Yes Yes

Parameter Values

Parameter Type Description
expression Boolean expression Required. A boolean expression that returns true or false.
message String or Object Required. The message or object to write to the console.

More Examples

Example

Write an object to the console:

Example

Write an array to the console:

Console Object

❮ Prop Frame Longdesc Obj History ❯