console.log('Request took:' , new Date() - start,'ms'); |
逗号间隔输出默认会 有空格在不同字段间
第一个参数中可以出现特殊指定
如下
Specifier | Description |
---|---|
%s | Formats the value as a string (cooercing via toString() if necessary) |
%d, %i | Formats the value as an integer |
%f | Formats the value as a floating point value |
%o | Formats the value as an expandable DOM Element (or JavaScript Object if it is not) |
%O | Formats the value as an expandable JavaScript Object |
%c | Formats the output string according to CSS styles you provide |
Firebug supports limiting the number of decimal places via %.xf, where x is the number of decimal places.console.log("Hello %s", "Brian");
> Hello Brian
// If the number of values exceeds the number of formatters, inputs should be appended/space delimited
console.log("I am %s and I have:", "1", 2, 3, 4); |