Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get "clear is not a function" from console on chrome dev tool

I hope anyone could help me understand this situation.
So, I wanted to clear the console after trying some simple codes like...

const smt = {printThis(){console.log(this)}};
smt.printThis();

and then typed clear as always, to clear it.

But then got this error saying clear is not a function.
And when typed clear and pressed enter, it shows tag. ...?

I really want to know what this is about, and hopefully, someone knows about it.
Just in case it's already been asked here, really sorry if my searching wasn't enough.

clearIsNotAFunction

like image 269
seyeonPark Avatar asked Jun 04 '26 21:06

seyeonPark


1 Answers

On that page, as you show, there is an element with id="clear". Elements with ids automatically create global variables pointing to them with the name of that variable being that id, so clear() in your console is trying to run the element, which leads to your error.

like image 108
connexo Avatar answered Jun 07 '26 10:06

connexo