The difference between JS console.log and console.dir

In our daily development, console.log()debugging is often used but rarely used console.dir(). So what is the difference between the two?
1. Comparison
    1. String// Number/ As you can see Object,Array
      Insert image description here
      Insert image description here
      there is no difference
    1. Function
      Insert image description here
      Insert image description here
      Print Function, you can see console.dirthat the corresponding attributes/methods are printed out
  1. DOMNode
    Insert image description here
    Insert image description here
    printing domnode, you can see: console.logprinting node, console.dirprinting domproperties and methods
2. Expand

There is also a less commonly used console.countfunction, which is to print the number of times a certain method has been called, for example:

Insert image description here

Guess you like

Origin blog.csdn.net/Vue2018/article/details/128955552