Back to Content

console: clear() static method

files/en-us/web/api/console/clear_static/index.md

latest935 B
Original Source

{{APIRef("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

js-nolint
console.clear()

Parameters

None.

Return value

None ({{jsxref("undefined")}}).

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also