简体   繁体   English

Chrome开发者工具中的console.log()vs console.clear()

[英]console.log() vs console.clear() in Chrome Developer tools

How come console.clear() works by just typing clear() in the console but you can't do stuff like log("Hello") in the console? 只需在控制台中键入clear()console.clear()如何工作,但是您无法在控制台中执行log("Hello")之类的工作?

You have to do console.log("Hello") to make it work. 您必须执行console.log("Hello")使其起作用。 Why is this? 为什么是这样?

clear is defined by the console itself. clear由控制台本身定义。 Notice that the snip below fails. 请注意,以下剪裁失败。 it isn't the same as console.clear . 它与console.clear

 console.log(clear); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM