console.log function-to-string.checker
Closed this issue · 5 comments
I am just starting with javascript, can you explain to me why console.log method is called twice when devtools is open.
Tks bro
good question. I'll write a blog this weekend to explain it.
sorry, I didn't run the 'chormium' debugging environment at the weekend, so I can only give a general description from memory.
when we run the code from the devtools console
It will actually be sent to 'devtools Host' execution
when the 'Console. API' execution is complete, it will be notified that execution has been completed
` args' is a serialized 'Remote Object',which is its definition:
we need to focus on the 'description' property because it' s the key, this is how it' s generated:
` Devtools' will use 'to String' to generate' description' property
so, we just overwrite toString
method, when devtools
is open, our function will be execute.
Thanks pro @AEPKILL
How will it detect? if I do console.log=()=>{};