HTML5技术

详解Google Chrome浏览器(操作篇) - Alan_beijing(5)

字号+ 作者:H5之家 来源:H5之家 2017-02-13 15:01 我要评论( )

// an object whose properties are stringsfunction Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName;}var me = new Person("John", "Smith");console.table(me); result:

// an object whose properties are strings function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } var me = new Person("John", "Smith"); console.table(me);

result:

示例3:

// an array of arrays var people = [["John", "Smith"], ["Jane", "Doe"], ["Emily", "Jones"]] console.table(people);

result:

示例4:

// an array of objects function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } var john = new Person("John", "Smith"); var jane = new Person("Jane", "Doe"); var emily = new Person("Emily", "Jones"); console.table([john, jane, emily]);

result:

示例5:

// an object whose properties are objects var family = {}; family.mother = new Person("Jane", "Smith"); family.father = new Person("John", "Smith"); family.daughter = new Person("Emily", "Smith"); console.table(family);

result:

示例6:

// an array of objects, logging only firstName function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } var john = new Person("John", "Smith"); var jane = new Person("Jane", "Doe"); var emily = new Person("Emily", "Jones"); console.table([john, jane, emily], ["firstName"]);

result:

17、console.time([label])

定义:Starts a new timer. Call console.timeEnd() to stop the timer and print the elapsed time to the Console.

译文:开始一个新的定时器。调用console.timeEnd()停止定时器,把已记时的时间打印到控制台。

示例1:

console.time(); var arr = new Array(10000); for (var i = 0; i < arr.length; i++) { arr[i] = new Object(); } console.timeEnd();

result:

示例2:

console.time('total'); var arr = new Array(10000); for (var i = 0; i < arr.length; i++) { arr[i] = new Object(); } console.timeEnd('total');

result:

示例3:

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • HTML5 拖放(Drag 和 Drop)详解与实例 - 孟然

    HTML5 拖放(Drag 和 Drop)详解与实例 - 孟然

    2017-02-06 16:01

  • 详解google Chrome浏览器(理论篇) - Alan_beijing

    详解google Chrome浏览器(理论篇) - Alan_beijing

    2017-01-31 12:00

  • 不常见但很有用的chrome调试工具使用方法 - 小火柴的蓝色理想

    不常见但很有用的chrome调试工具使用方法 - 小火柴的蓝色理想

    2017-01-24 14:00

  • Microsoft Edge与Google Chrome那些不同的举止 - fyter

    Microsoft Edge与Google Chrome那些不同的举止 - fyter

    2017-01-16 12:00

网友点评
6