注释规范
规范的注释很重要
代码是写给人看的,顺便给机器运行,多谢注释可以增加代码的可读性
1 |
|
变量命名规范
1.标准变量命名使用驼峰式命名 eg. let thisIsMyName;
2.常量全部大写,并使用下划线连接 eg. const MAX_COUNT = 10;
项目规范
变量声明尽量提在函数首部,用一个var声明,不允许出现连着的两个var声明(也包括let,const)
1 | function doSomethingWithItems(items) { |
undefind使用规范(永远不要直接使用undefined进行变量判断,使用typeof和字符串’undefined’对变量进行判断。)
1 | // not good |
用’===’和’!==’代替’==’, ‘!=’
使用对象的属性简写
1 | const job = 'FrontEnd' |
使用拓展运算符 … 复制数组
1 | // bad |
render使用
1 | render: (h, params) => { |
1291

被折叠的 条评论
为什么被折叠?



