console.log在我们的日常开发中是使用频率特别高的一句代码,那我们怎样在编译器中快速的打出来呢。其实很简单只要两步就行
1. 在VScode中打开文件 → 首选项 → 用户代码片段 → 在搜索框中搜索 JavaScript 选择 JavaScript.json
2. 然后我们在其中添加这样一段代码就好了
"Print to console": {
"prefix": "cl", // 也可以设置其他你习惯的快捷键.
"body": [
"console.log('$1');",
],
"description": "Log output to console"
}
接下来我们只要在平时使用时输入 cl +Tab 键就能快速打出 console.log()了。