2
我复制从另一个脚本(由我自己为了同样的目的写的),所以想不通为什么它按预期工作不匹配()在如果声明是真实的返回而不是数组
} else if (new_var = message.toLowerCase().match(/!test\s(.+)/) && user === 'user') {
然后我传递的message
!test test
所以我的理解是,new_var
应包含以下以下
new_var[0] = !test test
new_var[1] = test
然而,console.log(new_var)
被返回true
如果你打破了你的表情,以单一线条会更容易阅读,维护,共享和降低错误的几率。 https://sourcemaking.com/refactoring/decompose-conditional – Sukima