clear()

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Clears the console.

The Console's contents will be replaced with an informational message like "Console was cleared".

Note that in Google Chrome, console.clear() has no effect if the user has selected "Preserve log upon navigation" in the settings.

Syntax

console.clear();

Specifications

Specification Status Comment
Console API
The definition of 'console.clear()' in that specification.
Editor's Draft Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 48.0 (48.0) (Yes) (Yes) (Yes)
Available in workers ? ? ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 48.0 (48.0) ? ? ?
Available in workers ? ? ? ? ?

See also

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,