wangmm
V2EX  ›  问与答

怎么把 idea JS 文件中只要出现 == 就有黄色填充色给取消掉

  •  
  •   wangmm · Nov 23, 2017 · 8238 views
    This topic created in 3270 days ago, the information mentioned may be changed or developed.
    This inspection reports usages of JavaScript equality operators which may cause unexpected type coercions. It is considered a good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.
    Depending on the option selected, this will either highlight:
    All usages of == and != operators.
    All usages except comparison with null. Some code styles allow using x == null as a replacement for x === null || x === undefined.
    Only suspicious expressions, such as: == or != comparisons to 0, '', null, true, false, or undefined.
    8 replies  •  2017-11-23 18:03:32 +08:00
    QAPTEAWH
    QAPTEAWH
    Nov 23, 2017
    1
    alt-回车(mac 键位),有没有 disable inspection?
    wangmm
    wangmm
    OP
    Nov 23, 2017
    2
    @QAPTEAWH 没有
    pocketkids
    pocketkids
    Nov 23, 2017❤️1
    3
    Settings -> Editor -> Inspections -> JavaScript -> Probable bugs -> Equality operator may cause type coercion
    FrankFang128
    FrankFang128
    Nov 23, 2017
    4
    意思是 == 是个 BUG,请用 ===
    JS 就是这么坑
    FrankFang128
    FrankFang128
    Nov 23, 2017
    5
    == 都是跟新人用的,老手都会避开 ==
    wangmm
    wangmm
    OP
    Nov 23, 2017
    6
    @pocketkids 感谢 完美解决
    wangmm
    wangmm
    OP
    Nov 23, 2017
    7
    @FrankFang128 我才上班 这些都是别人写的 然后也就跟着用了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1894 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 01:49 · PVG 09:49 · LAX 17:49 · JFK 20:49
    ♥ Do have faith in what you're doing.