初学者必须知道的Console调试方法
程序员文章站
2022-03-02 13:04:18
...
console.log
- console.log(obj1 [, obj2, ..., objN);
- console.log(msg [, subst1, ..., substN);
- console.log('String: %s, Int: %d,Float: %f, Object: %o', str, ints, floats, obj)
- console.log(
temp的值为: ${temp}
)
console.log('123456')
console.log('debug-->', 'response failed')
console.log(1, 'messgae')
console.log(2, 'messgae')
输出
123456
debug--> response failed
1 messgae
2 messgae
console.time
console.timeLog
console.timeEnd
console.time('aTimer');
setTimeout(function () {
console.timeLog('aTimer');
}, 1000);
setTimeout(function () {
console.timeEnd('aTimer');
}, 2000);
输出
aTimer: 1005ms
aTimer: 2009ms
更多Console使用可以参考MDN
https://developer.mozilla.org/zh-CN/docs/Web/API/console
转载于:https://www.jianshu.com/p/dc2deae8e666
上一篇: js 判断两个对象是否相等