网站开发答辩演讲,档案馆网站安全建设,济南恢复娱乐场所,如何建设一个简易网站代码规范的一些事儿
问题
今日 Git 提交代码时#xff0c;出现报错#xff1a; error Unexpected lexical declaration in case block no-case-declarations
解决过程
我马上就去百度#xff0c;就找到了这篇文章#xff1a;解决 Unexpected lexical declaration in ca…代码规范的一些事儿
问题
今日 Git 提交代码时出现报错 error Unexpected lexical declaration in case block no-case-declarations
解决过程
我马上就去百度就找到了这篇文章解决 Unexpected lexical declaration in case block 的问题-腾讯云开发者社区-腾讯云
比如我报错的代码
switch (formType) {case 新增体系:const { info, title } values;try {// 添加请求const res await addDocs();// 重新获取数据更新当前页面// 省略...} catch (err) {console.log(出错啦~, err);}break;}一看我这个代码哪里有问题为什么提交不了
一顿操作猛如虎
修改这里修改那里始终提交不了。
结果一百度
该规则禁止词法声明 (let、const、function 和 class) 出现在 case或default 子句中。
解决
解析加上 花括号 解决问题。
switch (formType) {case 新增体系: {const { info, title } values;// 省略其他代码...break;}}总结
做好 switch 语句规范