Difference

  • console.log prints the element in an HTML-like tree
  • console.dir prints the element in a JSON-like tree

Example

console.dir() 与 console.log() 区别

Specifically, console.log gives special treatment to DOM elements, whereas console.dir does not.

This is often useful when trying to see the full representation of the DOM JS object.

SEE ALSO stackoverflow

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-07-05
  • 2022-02-12
相关资源
相似解决方案