• Firebug 控制台API


    1)         显示信息的命令

    n  console.log()                       //可以取代alert()

    n  console.debug()

    n  console.info()

    n  console.warn()

    n  console.error()

    2)         占位符

    console对象的方法可以像使用print()格式化结果

    字符串(%s)、整数(%d)、浮点数(%f)和对象(%o)四种

    var dog = {};

    dog.name="xiaoming";

    dog.color = "white";

    dog.call = function(){

             console.log('wang');

    }

    console.log('对象dog的结构\n%o', dog);

    The example above can be re-written without string substitution to achieve the same result:

    不用占位符可以这样写:animal,count是变量

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

    上面的两种结合使用

    console.log("I am %s and I have:", myName, thing1, thing2, thing3);

    3)         分组显示

    如果信息太多,可以分组显示

    console.group();

    console.groupEnd()

    4)         显示对象的属性和方法console.dir()

    与第二组的相似

    5)         显示某个结点所包含的html/xml代码

    console.dirxml(note)

    6)         断言,单元测试所得结果

    console.assert()

    7)         调试,追踪函数被调用轨迹

    console.trace()

    不知道为什么,调试不出来

    8)         显示代码运行时间,计时功能

    console.time和 console.timeEnd()

    9)         性能分析

    console.profile()和console.profileEnd()

    10)     属性菜单

    这里比较有用的是"显示XMLHttpRequests",也就是显示ajax请求。选中以后,网页的所有ajax请求,都会在控制台面板显示出来。

    11)     console.clear()                            //清屏

    http://www.iwms.net/n2273c17.aspx

    http://michaelsync.net/2007/09/09/firebug-tutorial-logging-profiling-and-commandline-part-i

  • 相关阅读:
    学习进度
    作业8:单元测试练习
    用户体验设计案例分析
    团队协作一
    需求分析
    结对编程——词频统计 2
    结对编程——词频统计
    个人项目-词频统计
    数组求和
    个人介绍和Github使用流程
  • 原文地址:https://www.cnblogs.com/mackxu/p/2628143.html
Copyright © 2020-2023  润新知