MDN self-hosted library · e01.org

console: clear() static method

Console API

no runnable cells web-api-static-method upstream source

Console API

The console.clear() static method clears the console if possible.

A graphical console, like those in web browsers, will remove all previous messages; a console displaying on a terminal, like the one in Node.js, will attempt to clear it using an escape code or system API; otherwise the method will have no effect (and no error).

Syntax

console.clear()

Parameters

None.

Return value

None (undefined).

Specifications

Browser compatibility

See also