【发布时间】:2021-04-15 15:09:36
【问题描述】:
我想缩写这个:
data.urlPath !== '#profile' && data.urlPath !== '#communities' && data.urlPath !== '#other'
类似于:
data.urlPath !== '#profile' || '#communities' || '#other'
// this doesn't work
这可能吗?
【问题讨论】:
-
我愿意
['#profile' ,' #other', '#...'].includes(data.urlPath) ? action : otherAction
标签: javascript comparison-operators