我想知道我是否可以清除控制台的一些命令。

Console.log(),可以打印…是否有清除控制台的命令?

我已经尝试console.log(控制台);得到下面这个函数。

assert: function assert() { [native code] }
constructor: function Console() { [native code] }
count: function count() { [native code] }
debug: function debug() { [native code] }
dir: function dir() { [native code] }
dirxml: function dirxml() { [native code] }
error: function error() { [native code] }
group: function group() { [native code] }
groupEnd: function groupEnd() { [native code] }
info: function info() { [native code] }
log: function log() { [native code] }
markTimeline: function markTimeline() { [native code] }
profile: function profile() { [native code] }
profileEnd: function profileEnd() { [native code] }
time: function time() { [native code] }
timeEnd: function timeEnd() { [native code] }
trace: function trace() { [native code] }
warn: function warn() { [native code] }
__proto__: Object

我想没有办法清理控制台……但我希望有人对我说……]


当前回答

你可以使用

console.clear();

如果您正在使用javascript编码。

否则,您可以使用CTR+L清除控制台编辑器。

其他回答

按CTRL+L快捷键清除日志,即使您选择了保存日志选项。 希望这能有所帮助。

你可以使用

console.clear();

如果您正在使用javascript编码。

否则,您可以使用CTR+L清除控制台编辑器。

如果你使用console.clear(),这似乎在chrome中工作。注意,它将输出“控制台已清除”消息。

注意,我在清除控制台后得到了一个错误,所以它不会禁用控制台,只清除它。此外,我只在chrome中尝试过,所以我不知道它是如何跨浏览器的。

编辑:我在Chrome、IE、Firefox和Opera中进行了测试。它适用于Chrome, MSIE和Opera的默认控制台,但不适用于Firefox,然而,它可以在Firebug中工作。

不用输入command,只需按:

CLTRL + L

清除chrome控制台

如果你只是想在调试时清除控制台,你可以简单地点击“ban-circle”⃠按钮来清除console.log。

或者,只需按“Ctrl+L”来清除控制台使用你的键盘。