Difference

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

Example

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

console.dir() 与 console.log() 区别的更多相关文章

  1. console.dir() 与 console.dirxml() 的使用

    在调试JavaScript程序时,有时需要dump某些对象的详细信息.通过手工编写JavaScript代码可以完成这一工作:针对对象的属性进行循环,将循环到的每一个属性值打印出来:可见,这一过程是比较 ...

  2. console.dir()和console.log()的区别

    console.log()可以取代alert()或document.write(),在网页脚本中使用console.log(data)时,会在控制台打印出数据. console.dir()可以显示一个 ...

  3. 【转】console.dir()和console.log()的区别

    原文链接:https://blog.csdn.net/ky1in93/article/details/80828499 console对象详解:https://segmentfault.com/a/1 ...

  4. console.log与console.dir的区别

    今天学习promise的时候看到了console.dir这个方法,感到很好奇,查了以下感觉又长知识了 在Chrome中,控制台对象定义了两个似乎做同样事情的方法: console.log() cons ...

  5. console.log()与console.dir()

    console.log()可以取代alert()或document.write(),在网页脚本中使用console.log()时,会在浏览器控制台打印出信息. console.dir()可以显示一个对 ...

  6. console.log()、console.info()、console.debug()的区别

    onsole.log().console.info().console.debug()的作用都是在浏览器控制台打印信息的. 使用最多的是console.log().console.info()和con ...

  7. 前端调用接口报错看不到报错响应时 console.dir

    console.dir() 可以看到很多.log看不到的属性和方法

  8. console.dir(someObject);

    <script type="text/javascript"> function test(){ var array = [{"id":1},{&q ...

  9. console.dir()可以显示一个对象所有的属性和方法

    console.dir()可以显示一个对象所有的属性和方法 具体方法如下:

随机推荐

  1. 10款最新流行的 jQuery 插件,值得你收藏

    10款最新流行的 jQuery 插件,值得你收藏 http://www.cnblogs.com/lhb25/p/10-new-popular-jquery-plugins-check.html 你应该 ...

  2. jackson注解使用心得

    maven依赖: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId ...

  3. GAME AI Pro 1 第1章

    和钱康来合作翻译的AI PRO 1和2 系列,计划是一周一篇,先捡着有意思的翻,对那篇有兴趣也可以留言给我优先翻译,希望都翻译好后有机会成书吧,有兴趣一起翻译的也可以联系我. 游戏人工智能是什么( W ...

  4. 合并多个工作薄workbooks到一个工作薄workbook

    微软示例教程 微软示例教程 Sub MergeAllWorkbooks() Dim SummarySheet As Worksheet Dim FolderPath As String Dim NRo ...

  5. .net web 小基累

    获取当前网站的根目录:HttpContext.Current.Request.PhysicalApplicationPath+“Content”

  6. web前端书籍

    前端开发 必看的书籍资料(转自CSDN郭小北V5) 一. html + css 这部分建议在 w3school 在线教程 上学习,边学边练,每个属性后还有在线测试. 然后过一遍之后可以模仿一些网站做些 ...

  7. 包管理工具Carthage使用

    iOS项目中第三方开源库的工具有Cocoapods和Carthage,swift官方出了一个包管理工具SPM(Swift Package Manager). 首先,大体讲一下Cocoapods和Car ...

  8. kafka总结

    近期在做kafka metrics. 参考了几个开源的项目,诸如kafka manager, Burrow, kafkaOffsetMonitor,东西都很不错,可惜没有一个是用java编写的,最终自 ...

  9. ubuntu下的时间设定(硬件时间,系统时间,本地时间)

    问题的来由是在这里: 在cron里设定任务是在凌晨6点执行,检查日志时发现时间总是不对,是在22点左右的时间执行的.研究发现,任务是在本地时间的6点执行了,但不知为什么syslog中的时间都是为utc ...

  10. Karma+Jasmine实现自动化单元测试

    1.Karma介绍 Karma是Testacular的新名字,在2012年google开源了Testacular,2013年Testacular改名为Karma.Karma是一个让人感到非常神秘的名字 ...