if( type == 1 || type == 2 || type == 3 || type == 4 || ){ //... }
使用ES6中数组实例方法includes
includes
const condition = [1,2,3,4]; if( condition.includes(type) ){ //... }
← 封装if中多个条件 处理扁平化数组→