代码优化积累【持续更新】
#判断优化(处理多个选择优化)
//bad if(condition = 'aa' ||condition = 'bb' || condition = 'cc' ){ //TODO } //good let Regcondition = /^(aa|bb|cc)$/; Regcondition.test(condition)
//good
var collection = ['aa','bb','cc'];
collection.includes(condition)
#