The console.clear() method clears the console if the console allows it. You can call it directly from Chrome’s console by simply typing clear()
, console.clear()
or window.clear()
.
The console.log() method outputs a message to the web console. You cannot call it directly from Chrome’s console by simply typing log()
. You have to use console.log()
.
I would understand this if clear()
was a method listed inside the window
object pointing to the method in the console
, but it isn’t listed when logging console.log(window)
or console.log(this)
in the console.
Why is clear
directly accessible but log
not?