JS代码规范之优化技巧
## 1.带有多个条件的 if 语句
把多个值放在一个数组中,然后调用数组的 includes 方法。
```javascript
// longhand
if (x === 'abc' || x === 'def' || x === 'ghi' || x ==='jkl') {
// logic
}
// shorthand
if (['abc', 'def', 'ghi', 'jkl'].includes(x)) {
// logic
}
```
<!--more-->
## 2. 简化 if true...else
对于不包含
more...



