THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM console.clear() Method

❮ Console Object

Example

Clear all messages in the console:

console.clear();
Try it Yourself »

Definition and Usage

The console.clear() method clears the console.

The console.clear() method will also write a message in the console: "Console was cleared".


Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
console.clear() Yes Yes 48 Yes Yes

Syntax

console.clear()

❮ Console Object