[JavaScript] FireBug 调试
Firebug Script 调试记录
-
Your new friend, console.log //显示变量 参数
console.log,
console.debug
, console.info
,
console.warn
, console.error
...
console.log("hello world")
console.log(2,4,6,8,"foo",bar)
console.log("%a,%b","foo",bar) // "%"用于定义量
console.log("%s is %d years old.", "Bob", 42).
console.log(2,4,6,8,"foo",bar)
console.log("%a,%b","foo",bar) // "%"用于定义量
console.log("%s is %d years old.", "Bob", 42).
-
Timing and profiling // 时间及性能分析
console.profile(); //性能开始
console.time("test"); //时间开始
function Test()
{
for(var i = 0; i < 10; i++)
{
console.info("this is a test");
}
}
Test();
console.timeEnd("test"); //时间结束
console.profileEnd(); // 性能结束
console.time("test"); //时间开始
function Test()
{
for(var i = 0; i < 10; i++)
{
console.info("this is a test");
}
}
Test();
console.timeEnd("test"); //时间结束
console.profileEnd(); // 性能结束
-
Stack traces
console.trace()
- Nested grouping
Just call
console.group("a title")
to start a new indentation
block, and then console.groupEnd()
to close the block. You can
create as many levels of indentation as you please.-
Object inspection // 显示对象信息
Calling console.dir(object)
will log an interactive listing of
an object's properties, like a miniature version of the DOM tab.
Calling
console.dirxml(element)
on any HTML or XML element will print a
lovely XML outline, like a miniature version of the HTML tab.
console.dir(document.getElementById("sleCategory"));
console.dirxml(document.getElementById("sleCategory"));
console.dirxml(document.getElementById("sleCategory"));
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步