Introduction
The console.clear() method can clear all messages from console.log()
NOTICE
It will take effect on graphical browser.
Otherwise (such as in DOS terminal), it may have no effect and NOT cause error.
Example
Example 1
Code
<!DOCTYPE html5>
<html>
<body>
<script>
console.log("1");
console.log("2");
console.clear();
console.log("3");
</script>
</body>
</html>
Output
Example 2
Code
console.log("1");
console.log("2");
console.clear();
console.log("3");
Output