vue-cli - 请教一个Javascript的问题
迷茫
迷茫 2017-04-10 17:24:15
[JavaScript讨论组]
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
  }
}
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全部回复(4)
阿神
a === b === c 
//执行顺序是
a===b //true
true===c //false
高洛峰
a===b && b===c
伊谢尔伦

三个不能连着用吧啊
你的a===b返回布尔值
再来个boolean === c 你觉得会返回true吗

PHP中文网

对啊,为什么要三个连着

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号