vscode中console.log的写法有哪些,有何不同
Admin 2022-07-05 群英技术资讯 1274 次浏览
这篇文章给大家分享的是“vscode中console.log的写法有哪些,有何不同”,对大家学习和理解有一定的参考价值和帮助,有这方面学习需要的朋友,接下来就跟随小编一起学习一下吧。(一)方法一:直接在script标签中提前定义,仅适用于该html文件!
let add = function(a,b){
return a + b;
};
console.log(add(20,300));
const { ['log']:C } = console;
C(add(20,300));
(二)方法二:按tab键快速生成console.log,且光标在()内部,再次按tab键光标自动跳转到下一行!
1、打开vscode编辑器,选择文件->首选项->用户片段,输入javascript.json并按下enter进入。
初次使用我们会发现一段被注释的代码如下:
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
}
2、解除Example以下的区间代码如下,其中部分参数意义如下:
①prefix:代码快捷键的入口,在这里我们根据个人习惯进行设置即可,如我设置的cl,那么配合tab健就可以直接生成console.log;
②body表示代码主体:
$1表示生成代码快速生成后后光标首次出现的位置
$2写在"console.log('$1');"下面,表示在快速生成console.log()后,代码后会空出一行,并且再次按tab键时,光标会跳转到$2(空出的一行)的位置
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "cl",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
排序算法是笔试中经常出现的,提起排序算法就一定要提下算法复杂度和大O表示法,算法复杂度是指算法在编写成可执行程序后,运行时所需要的资源,资源包括时间资源和内存资源,这篇文章主要给大家介绍了关于如何利用JavaScript实现排序算法的相关资料,需要的朋友可以参考下
这篇文章主要介绍了在js中修改html body的样式,下面文章围绕js修改html 和body样式的相关资料展开详细内容,需要的朋友可以参考一下,希望对大家有所帮助
vue中路由自动导入的方式是什么?vue中导入路由是很基础的操作,本文给大家分享的是vue中路由自动导入的方法,下文还有示例供大家参考,感兴趣的朋友就继续往下看吧。
这篇文章主要介绍了解决vant的Toast组件时提示not defined的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
JS定时器如何实现提交成功提示功能, 应用场景:<br /> 用户评论后,在合适位置弹出“评论成功”,2秒钟后自动消失,提示用户评论成功。<br /> HTML:<br /> <br /> <br /> {#评论成功提示#}<br /> <div class="popup_con" style="display
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 ICP核准(ICP备案)粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008