Chrome JavaScript Debugging: how to break when a value changes

后端 未结 3 1374
梦谈多话
梦谈多话 2020-12-14 10:48

I am debugging a large JavaScript code base where, at some point, the \"console\" variable gets nulled when refreshing the page.

Is there a way to set a watch on con

3条回答
  •  眼角桃花
    2020-12-14 11:32

    Browser-implemented functions can't be null-ed! Technically speaking.

    If window.console.log funcion was assigned null, then just restore it deleting it!

    delete console.log
    

    That will do the job :)

    EDIT: That's not an answer to your main question, but I think your question is comming from you searching a way to debug, so this answer basically skips the need to detect var changes.

提交回复
热议问题