Firebug 调试技巧之console API

console.log(object[, object, ...])

Writes a message to the console. You may pass as many arguments as you‘d like, and they will be joined together in a space-delimited line.

console.debug(object[, object, ...])

Writes a message to the console, including a hyperlink to the line where it was called.

console.info(object[, object, ...])

Writes a message to the console with the visual "info" icon and color coding and a hyperlink to the line where it was called.

console.warn(object[, object, ...])

Writes a message to the console with the visual "warning" icon and color coding and a hyperlink to the line where it was called.

console.error(object[, object, ...])

Writes a message to the console with the visual "error" icon and color coding and a hyperlink to the line where it was called.

console.assert(expression[, object, ...])

Tests that an expression is true. If not, it will write a message to the console and throw an exception.

console.clear()

Clears the console.

console.dir(object)

Prints an interactive listing of all properties of the object. This looks identical to the view that you would see in the DOM Panel.

console.dirxml(node)

Prints the XML source tree of an HTML or XML element. This looks identical to the view that you would see in the HTML Panel. You can click on any node to inspect it in the HTML Panel.

console.trace()

Prints an interactive stack trace of JavaScript execution at the point where it is called.

The stack trace details the functions on the stack, as well as the values that were passed as arguments to each function. You can click each function to take you to its source in the Script tab, and click each argument value to inspect it in the DOM or HTML Panel.

console.group(object[, object, ...])

Writes a message to the console and opens a nested block to indent all future messages sent to the console. Call console.groupEnd() to close the block.

console.groupCollapsed(object[, object, ...])

Like console.group(), but the block is initially collapsed.

console.groupEnd()

Closes the most recently opened block created by a call to console.group() or console.groupCollapsed()

console.time(name)

Creates a new timer under the given name. Call console.timeEnd() with the same name to stop the timer and print the time elapsed.

console.timeEnd(name)

Stops a timer created by a call to console.time(name) and writes the time elapsed.

console.timeStamp(name)

Creates a time stamp, which can be used together with HTTP traffic timing to measure when a certain piece of code was executed.

console.profile([title])

Turns on the JavaScript profiler.

console.profileEnd()

Turns off the JavaScript profiler and prints its report.

console.count([title])

Writes the number of times that the line of code where count was called was executed.

console.exception(error-object[, object, ...])

Prints an error message together with an interactive stack trace of JavaScript execution at the point where the exception occurred.

console.table(data[, columns])

Allows to log provided data using tabular layout.

时间: 2024-10-09 01:27:15

Firebug 调试技巧之console API的相关文章

JavaScript调试技巧之console.log()详解

转载 对于JavaScript程序的调试,相比于alert(),使用console.log()是一种更好的方式,原因在于:alert()函数会阻断JavaScript程序的执行,从而造成副作用:而console.log()仅在控制台中打印相关信息,因此不会造成类似的顾虑 一.什么是console.log()?除了一些很老版本的浏览器,现今大多数浏览器都自带调试功能:即使没有调试功能,也可以通过安装插件来进行补充.比如,老版本的Firefox没有自带调试工具,在这种情况下可以通过安装Firebug

JavaScript调试技巧之console.log()详解--2015-08-07

对于JavaScript程序的调试,相比于alert(),使用console.log()是一种更好的方式,原因在于:alert()函数会阻断 JavaScript程序的执行,从而造成副作用:而console.log()仅在控制台中打印相关信息,因此不会造成类似的顾虑 一.什么是console.log()?除了一些很老版本的浏览器,现今大多数浏览器都自带调试功能: 即使没有调试功能,也可以通过安装插件来进行补充.比如,老版本的Firefox没有自带调试工具,在这种情况下可以通过安装Firebug插

Firebug Console API

原文发布时间为:2011-06-06 -- 来源于本人的百度文章 [由搬家工具导入] Console API 当打开 firebug (也包括 Chrome 等浏览器的自带调试工具),window 下面会注册一个叫做 console 的对象,它提供多种方法向控制台输出信息,供开发人员调试使用。下面是这些方法的一个简单介绍,适时地运用它们,对于提高开发效率很有帮助。 console.log(object[, object, ...]) 使用频率最高的一条语句:向控制台输出一条消息。支持 C 语言

js调试技巧 Firefox调试技巧汇总

Firebug入门指南        :  http://www.ruanyifeng.com/blog/2008/06/firebug_tutorial.html Firebug控制台详解: http://www.cnblogs.com/see7di/archive/2011/11/21/2257442.html    http://www.cnblogs.com/leejersey/archive/2012/11/27/2790998.html debugger: js中调用console写

JS firebug小技巧

实际上前端的发展与进步也离不开浏览器的支持,而对于开发人员来讲,浏览器最好的支持,就是对于debug的良好支持,甚至在某些后续接手的项目中,前端的debug甚至可以解决好多问题--不说了,都是泪啊!还是说下firefox下的firebug吧.虽然ff内置一个调试的功能,但是,感觉不完善,对于开发人员来讲,根本不够用,于是ff下还是推荐firebug,老牌的前端debug工具,好用!而IE.Chrome都有很不错的工具支持,基本够用,但是用惯了ff的我,还是坚挺在firebug下. 1.使用"de

firebug小技巧s

最近这几年,企业应用的前端很火,呵呵-- 本来不想掺和进来,可是实在禁不住前端这百般撩拨. 实际上前端的发展与进步也离不开浏览器的支持,而对于开发人员来讲,浏览器最好的支持,就是对于debug的良好支持,甚至在某些后续接手的项目中,前端的debug甚至可以解决好多问题--不说了,都是泪啊!还是说下firefox下的firebug吧.虽然ff内置一个调试的功能,但是,感觉不完善,对于开发人员来讲,根本不够用,于是ff下还是推荐firebug,老牌的前端debug工具,好用!而IE.Chrome都有

Chrome实用调试技巧

如今Chrome浏览器无疑是最受前端青睐的工具,原因除了界面简洁.大量的应用插件,良好的代码规范支持.强大的V8解释器之外,还因为Chrome开发者工具提供了大量的便捷功能,方便我们前端调试代码,我们在日常开发中是越来越离不开Chrome,是否熟练掌握Chrome调试技巧恐怕也会成为考量前端技术水平的标杆. 介绍Chrome调试技巧的文章很多,本文结合我自己的开发经验,希望从实际运用的角度为大家再一次谈一谈这些功能,也希望对大家都有所帮助和启发. 常用快捷键 ctrl+p 项目中定位文件,以下查

JavaScript调试技巧之断点调试

首先,在各个浏览器中,断点调试支持的最好的当然是Firefox,Firefox不仅可以使用Firebug调试页面js脚本,还可以用高级调试工具例如JavaScript Debugger (Venkman) 来调试Firefox扩展里的js.除此之外,Firefox还支持一些更为高级的断点调试.变量监视功能. 其他浏览器里,Opera.Chrome和Safari的调试功能也比较好用.Opera的DragonFly速度相对比较快,界面清爽,功能强大,但不如Safari等友好.相比来说,IE8的程序员

Console API 与命令行

一.Console API 当打开 firebug (也包括 Chrome 等浏览器的自带调试工具),window 下面会注册一个叫做 console 的对象,它提供多种方法向控制台输出信息,供开发人员调试使用.下面是这些方法的一个简单介绍,适时地运用它们,对于提高开发效率很有帮助. (1) console.log(object[, object, ...]) 使用频率最高的一条语句:向控制台输出一条消息.支持 C 语言 printf 式的格式化输出.当然,也可以不使用格式化输出来达到同样的目的