console: clear() static method

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
clear()

Parameters

None.

Return value

None (undefined).

Specifications

Specification
Console Standard
# clear

Browser compatibility

desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
Deno
Node.js
clear() static method

See also