Created
May 20, 2012 09:00
-
-
Save simplelife7/2757424 to your computer and use it in GitHub Desktop.
【JS】console调试常用方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 尽量使用,可以传入多个参数,最后输出拼接后的字符串 | |
console.log('xx','xx','...'); | |
console.dir(someObj); | |
console.dirxml(someDom); | |
console.time('timer'); | |
console.warn('xxx'); | |
// 封装可以保证不小心发布出去也不会导致问题,但报错时行号可能有问题 | |
function msg(msg){ | |
if(console && console.log){ | |
console.log(msg); // wrong line number | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment