javascript - Nodejs如何将多个id放入if
问题描述
当我尝试将多个 id 放入一个 if 它只注册第一个时。
if (message.author.id != '196568585202565121' || '110324497353052160') return message.reply("You don't have the perms")
它只会回复第一个 id 而不是第二个。第二个会得到你没有烫发的消息。
解决方案
您可以将数组与.includes()
方法一起使用。
if(!['196568585202565121','110324497353052160'].includes(message.author.id)) {
// to the things...
}
推荐阅读
- swift - 为什么让我的视图的框架返回全屏,即使视图已经通过了 safeArea 约束?
- react-native - React Native - NSNumber 类型的 JSON 值“27”无法转换为 NSString
- python-3.x - selenium python webdriver,如何引用元素
- flutter - 为什么在 Dart 的列表定义中使用 if 和 for?
- aws-lambda - API Gateway 上的集成延迟
- javascript - 图像组件React Native中的多条曲线
- python - 字典自动调用作为值的函数
- json - 如何在不快速在表格视图中添加另一行的情况下编辑行
- visual-studio - 如何在本地进行确定性构建(ContinuousIntegrationBuild 标志)?
- python - 查找每列中最后一个真值的行位置列表