作為JS程序員,自己寫的代碼如果好看易讀,不只是自己看起來好看,在別的程序員接手以后,也會是交接工作異常順利。
不要在代碼中留大段注釋掉的代碼
留給git去管理,不然你要git干嘛
// bad// function add() {// const a = b + c// return a// }function add() { return a + 1000}// goodfunction add() { return a + 1000}適當地換行
// badfunction a() { const { state_a, state_b, state_c } = this.state this.setState({state_a: state_a * 2}) return 'done'}// goodfunction a() { const { state_a, state_b, state_c } = this.state this.setState({state_a: state_a * 2}) return 'done'}適當的添加注釋,但不要瘋狂的添加注釋
對一段代碼或者一行特別需要注意的代碼注釋
不要瘋狂的注釋,太 主站蜘蛛池模板: 绥江县| 托克逊县| 吕梁市| 宣城市| 牟定县| 大洼县| 五华县| 武定县| 渭源县| 虹口区| 宾阳县| 襄汾县| 阿勒泰市| 赣榆县| 新泰市| 海城市| 保定市| 肇东市| 河北省| 临泽县| 抚州市| 普兰县| 密山市| 虞城县| 兰考县| 临沧市| 筠连县| 刚察县| 洛浦县| 壤塘县| 宜城市| 丰台区| 霍林郭勒市| 翼城县| 泌阳县| 大英县| 凤庆县| 巴塘县| 屏南县| 荆门市| 徐水县|