在做前端开发时,有时直接用alert方法比较麻烦,可以直接将日志打印到浏览器的控制台
使用console的log、info、warn、error方法
以下是各个浏览器对日志方法的支持:
| 1 | IE | log info warn error assert dir clear profile profileEnd |
| 2 | Firebug | log info warn error debug exception assert dir dirxml trace group groupEnd groupCollapsed time timeEnd profile profileEnd count clear table notifyFirebug firebug |
| 3 | Chrom | log info warn error profiles memory debug dir dirxml trace assert count markTimeline profile profileEnd time timeEnd group groupCollapsed groupEnd |
| 4 | Opera | log info warn error time timeEnd trace profile profileEnd debug assert dir dirxml group groupCollapsed groupEnd count table |
从表中可以看出,四个平台都有log info warn error 四个方法,有的甚至有debug模式的打印。

本文介绍了在前端开发过程中,不同浏览器对于console日志方法的支持情况,包括log、info、warn、error等常用方法,并对比了IE、Firebug、Chrome及Opera四个平台的功能差异。
6158

被折叠的 条评论
为什么被折叠?



