2021-02-27
There are some widely-used / interesting methods of console objects.
First, we can console the console itself to see all the methods :P
1 console.log(console)2
console.log()
substitutions (Chrome support)
%o %Ojs object
see more: https://stackoverflow.com/questions/68449497/difference-between-o-and-o-in-console-log-javascript
%s string
1console.log("Hello %s, my name is %s", 'world', 'Mary',);2// "Hello world, my name is Mary."3
%c css
1console.log("This is %cMy stylish message", "color: yellow; font-style: italic; background-color: blue;padding: 2px");2console.log('%c ', 'font-size:400px; background:url(https://pics.me.me/codeit-google-until-youfinda-stackoverflow-answerwith-code-to-copy-paste-34126823.png) no-repeat;');3
console.info()
console.dir(obj) / console.dirxml(obj)
console.warn()
console.error()
console.group() / console.groupEnd()
console.trace()
console.table() https://developer.mozilla.org/zh-CN/docs/Web/API/Console/table
1// an array of strings23console.table(["apples", "oranges", "bananas"]);4