console.log允许你通过css来格式化输出,格式如下:
console.log(‘%c字符串[%c字符串]’, 样式1, [样式2])
其中”%c”为模板字符串
1
|
console.log(‘%cerrow‘,‘color:#fff;background:red‘)
|
输出结果:
1
|
console.log(‘%cerrow %cmessage‘,‘color:#fff;background:red‘,‘color:white;background:#ccc‘)
|
输出结果:
原文:http://www.cnblogs.com/libin-1/p/6395763.html