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. |
Living Standard | Initial definition |
Browser compatibility
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | 48.0 (48.0) | (Yes) | (Yes) | (Yes) |
| Available in workers | ? | (Yes) | ? | ? | ? | ? |
| Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | ? | (Yes) | 48.0 (48.0) | ? | ? | ? |
| Available in workers | ? | (Yes) | ? | ? | ? | ? |