Šim*_*das 5 javascript browser console.log
Twitter的网站有类似的东西
console.log = function () {};
Run Code Online (Sandbox Code Playgroud)
将浏览器的内置console.log
方法转换为无操作.我有办法恢复原来的功能吗?
除非他们也在原型中删除了它,否则log
使用该方法 getPrototypeOf()
应该可以工作:
console.log = Object.getPrototypeOf(console).log;
Run Code Online (Sandbox Code Playgroud)
由于使用了console.log = function() {}
重写,但没有删除原型中定义的方法,因此您可以删除重写方法:
delete console.log
Run Code Online (Sandbox Code Playgroud)