Javascript Console Clear禁用所有控制台日志,而不是清除

Javascript Console Clear disables all console logs instead of clearing

本文关键字:日志 清除 控制台 Clear Console Javascript      更新时间:2023-09-26

我的main.js文件加载在index.html中,并以

开头
console.clear();

所以我在项目开始前得到一个干净的控制台。奇怪的是,任何跟随控制台的日志。Clear也不再显示了!

console.clear();
console.log("starting the project");
console.log("but these logs are not shown...");

如何清除控制台然后开始记录消息?

Works good for me http://jsfiddle.net/3rd26za5/

console.log("before clear");
console.clear();
console.log("starting the project");
console.log("but these logs are not shown...");

代码:

console.clear();
console.log("This prints normally.");
输出:

This prints normally.

适合我。