? ? 比较相似数据对象
?
console.table([{a:1,b:2,c:3},{a:"foo",b:false,c:undefined}]);
console.table([[1,2,3],[2,3,4]]);
? ?function Person(firstName, lastName, age) { this.firstName = firstName; this.lastName = lastName; this.age = age; } var family = {}; family.mother = new Person("Susan", "Doyle", 32); family.father = new Person("John", "Doyle", 33); family.daughter = new Person("Lily", "Doyle", 5); family.son = new Person("Mike", "Doyle", 8); console.table(family, ["firstName", "lastName", "age"]);?
console.time("Array initialize"); var array= new Array(1000000); for (var i = array.length - 1; i >= 0; i--) { array[i] = new Object(); }; console.timeEnd("Array initialize");
function login(user) { console.count("Login called for user " + user); } users = [ // by last name since we have too many Pauls. ‘Irish‘, ‘Bakaus‘, ‘Kinlan‘ ]; users.forEach(function(element, index, array) { login(element); }); login(users[0]);?
原文:http://zhangzhaoaaa.iteye.com/blog/2248519