console中一些不常用的实用方法
console.group('分组1');
console.table(
[
{key1: 1,key2: 2,key3: 3},
{key1: 1,key2: 2,key3: 3},
{key1: 1,key2: 2,key3: 3}
],
['key1', 'key2'] /*可选:要显示的key,其它忽略*/
);
console.groupEnd('分组1');
//-------------------------
console.groupCollapsed('分组2'); /*默认关闭的分组*/
console.table(
[
{key1: 1,key2: 2,key3: 3},
{key1: 1,key2: 2,key3: 3},
{key1: 1,key2: 2,key3: 3}
],
['key1', 'key2'] /*可选:要显示的key,其它忽略*/
);
console.groupEnd('分组2');
//-------------------------
console.timeStamp(); //在时间轴中添加一个标记
//-------------------------
console.time('计时');
//do something
console.timeEnd('计时');
//-------------------------
//条件断点的妙用
object.x = 1; //expression break point: console.table(object);
作者:阿良
出处:http://www.cnblogs.com/arliang
本文采用知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议
进行许可,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。

浙公网安备 33010602011771号