How to check if 'debugger;' keyword exists?

后端 未结 4 1962
野趣味
野趣味 2021-02-08 11:06

Sometimes some developers forgot to remove debugger; in javascript code, and it produce javascript error on IE. How can you check (like for the console: if(wi

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-08 11:47

    You cannot.

    The best solution would be adding a hook to your version control system to prevent code containing debugger; statements from being committed/pushed.

    Asking your devs to search for debugger; or at least have a careful look at the diff before committing is also a solution - but not as effective as hard-rejecting in the VCS.

提交回复
热议问题