HTML DOM console.clear()Method

Console 对象Console Object

Example

Clear all information on the console:

console.clear();

Try it yourself »

Definition and Usage

The console.clear() method is used to clear all information in the console.

After successful execution, the console.clear() method will output "Console was cleared" to the console.


Syntax

console.clear()

Browser Support

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

Method
console.clear() Yes Yes 48 Yes Yes

Console 对象Console Object

Other Extensions