最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

詳解vscode中console.log的兩種快速寫法

 更新時間:2021年11月08日 11:16:40   作者:時光-ing  
這篇文章主要介紹了vscode中console.log的兩種快速寫法,每種方法通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下

(一)方法一:直接在script標(biāo)簽中提前定義,僅適用于該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,且光標(biāo)在()內(nèi)部,再次按tab鍵光標(biāo)自動跳轉(zhuǎn)到下一行!
1、打開vscode編輯器,選擇文件->首選項->用戶片段,輸入javascript.json并按下enter進入。
初次使用我們會發(fā)現(xiàn)一段被注釋的代碼如下:

{
	// 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以下的區(qū)間代碼如下,其中部分參數(shù)意義如下:
①prefix:代碼快捷鍵的入口,在這里我們根據(jù)個人習(xí)慣進行設(shè)置即可,如我設(shè)置的cl,那么配合tab健就可以直接生成console.log;
②body表示代碼主體:
$1表示生成代碼快速生成后后光標(biāo)首次出現(xiàn)的位置
$2寫在"console.log('$1');"下面,表示在快速生成console.log()后,代碼后會空出一行,并且再次按tab鍵時,光標(biāo)會跳轉(zhuǎn)到$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"
	}
}

到此這篇關(guān)于vscode中console.log的兩種快速寫法的文章就介紹到這了,更多相關(guān)vscode console.log寫法內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

疏勒县| 浦北县| 清远市| 永城市| 和龙市| 龙胜| 桃源县| 望谟县| 志丹县| 通江县| 盐源县| 乌苏市| 泽州县| 呼伦贝尔市| 南乐县| 教育| 兴义市| 兰坪| 分宜县| 兰州市| 都匀市| 宁津县| 建水县| 桦南县| 通海县| 鹤峰县| 扶沟县| 呼和浩特市| 慈溪市| 中阳县| 探索| 巴楚县| 景宁| 余姚市| 桐庐县| 勃利县| 山东省| 上饶市| 景洪市| 资阳市| 呼图壁县|