[Javascript] Format console.log with CSS and String Template Tags
2024-08-31 19:29:48
The Chrome console allows you to format messages using CSS properties. This lesson walks you through the syntax of formatting your logs with css then refactoring into a template tag function to make formatting more reusable.
const debug = (label, style, obj) => {
console.log(`%c${label}`, `${style}`, `${obj}`);
}; debug(
`debug: `,
`color: white; background-color: grey; padding: .5em;`,
JSON.stringify({name: 'Zhentian'}));
最新文章
- java:警告:[unchecked] 对作为普通类型 java.util.HashMap 的成员的put(K,V) 的调用未经检查
- 关于mysql的几个必知点
- png图片尺寸大小调整
- 炉石传说 C# 开发笔记 (源代码整理公开)
- underscorejs
- 【Winform】DataTable绑定到ComboBox
- uiscrollerview循环滚动(参考第三方库:HMBannerView)https://github.com/iunion/autoScrollBanner
- android anim 动画效果(转)
- [转]python集合set
- 微信内移动前端开发抓包调试工具fiddler使用教程
- A Game of Thrones(20) - Eddard
- GBK,UTF8是什么?有什么区别,做网站选择哪种好?
- hdu 2018递推
- PHP XML 函数
- 大数据与Mapreduce
- copyOf数组复制方法的使用(数组扩容练习)
- Xcode 常用代码段
- Win10下Clion配置opencv3
- MVC的Filter应用小结
- emacs之配置4,颜色插件