var a=1, b=1, c=1;
现在使用了eslint 插件,直接这样比较的话eslint会报错,
a == b == c (true 期望结果)
// eslint报错信息
error eqeqeq Expected '===' and instead saw '=='
但是替换成这样,类型又不对了
a === b === c (false b === c 会返回 true )
请问有什么好的办法解决么?
.eslintrc配置
module.exports = {
root: true,
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
三个不能连着用吧啊
你的a===b返回布尔值
再来个boolean === c 你觉得会返回true吗
对啊,为什么要三个连着