作为JS程序员,自己写的代码如果好看易读,不只是自己看起来好看,在别的程序员接手以后,也会是交接工作异常顺利。
不要在代码中留大段注释掉的代码
留给git去管理,不然你要git干嘛
// bad
// function add() {
// const a = b + c
// return a
// }
function add() {
return a + 1000
}
// good
function add() {
return a + 1000
}
适当地换行
// bad
function a() {
const {
state_a,
state_b,
state