console: clear() static method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The console.clear() static method clears the console if the console allows it. A graphical console, like those running on browsers, will allow it; a console displaying on the terminal, like the one running on Node, will not support it, and will have no effect (and no error).

Syntax

js
console.clear()

Parameters

None.

Return value

None (undefined).

Specifications

Specification
Console Standard
# clear

Browser compatibility

BCD tables only load in the browser

See also