console.clear()


stdout 是终端时,调用 console.clear() 将尝试清除终端。 当 stdout 不是终端时,此方法不执行任何操作。

console.clear() 的具体操作可能因操作系统和终端类型而异。 对于大多数 Linux 操作系统,console.clear() 的操作类似于 clear shell 命令。 在 Windows 上,console.clear() 将仅清除 Node.js 二进制文件的当前终端视口中的输出。

When stdout is a TTY, calling console.clear() will attempt to clear the TTY. When stdout is not a TTY, this method does nothing.

The specific operation of console.clear() can vary across operating systems and terminal types. For most Linux operating systems, console.clear() operates similarly to the clear shell command. On Windows, console.clear() will clear only the output in the current terminal viewport for the Node.js binary.