console调试

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

往控制台写一条信息,可以有多个参数,甚至可以像printf那样格式化出去,例如

console.log("The %s jumped over %d tall buildings", animal, count);

或者这样:

console.log("The", animal, "jumped over", count, "tall buildings");
console.log("I am %s and I have:", myName, thing1, thing2, thing3);
下面是格式化参数表:
String Substitution Patterns
%s String
%d, %i Integer (numeric formatting is not yet supported)
%f Floating point number (numeric formatting is not yet supported)
%o Object hyperlink

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

向控制台输出一条信息,同时包含了跳往调用行的链接

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

向控制台输出一条信息,前面显示“信息”图标,同样包含了跳往调用行的链接

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

向控制台输出一条信息,前面显示“警告”图标,同样包含了跳往调用行的链接

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

向控制台输出一条信息,前面显示“错误”图标,同样包含了跳往调用行的链接

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

校验是否符合表达式,如果不符合,将向控制台输出错误信息,并且抛出异常

console.dir(object)

输出对象的所有属性,可以在DOM标签中看到详细信息

console.dirxml(node)

输出HTML或XML元素的XML代码树,可以再HTML中查看详细的情况

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 tabs.

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

分组输出,和console.groupEnd()配合使用,知道下一个console.groupEnd()出现,就闭合分组

console.groupEnd()

和console.group()配合使用

console.time(name)

创建一个定时器,知道调用console.time(name),才停止该定时器计时

console.timeEnd(name)

和console.time(name)配合使用

console.profile([title])

Turns on the JavaScript profiler. The optional argument title would contain the text to be printed in the header of the profile report

console.profileEnd()

Turns off the JavaScript profiler and prints its report

console.count([title])

 计数器,每执行一次,该title的值就累加1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值