How to disable debugger; command in JS?

2019-09-21 01:38发布

window.alert = function(msg){console.log('foo' + msg);};
alert("bar");

foobar

screenshot of chrome console:

enter image description here

My problem is if I try disable debugger; command with this, do not work:

window.debugger = function(){console.log('faa');};
debugger;

when I run debugger;, breakpoint stop my app.

1条回答
在下西门庆
2楼-- · 2019-09-21 01:45

debugger is not a member of window, it's only a sign for the browser to know to stop there on debug mode.

查看更多
登录 后发表回答