clear()
is a method of the console
object just like log()
. console.log()
, console.clear()
work as expected but only writing clear()
also works without prefixing with the object where it lives.
It seems like the clear()
method also lives on the global object window
. But I can’t find it in the window
object.
mdn says console
methods are instance methods on the sidebar but in the title, it says ‘console: clear() static method’.
Can something be a static and an instance method at the same time?
What is going on here?