Comparing to null - !== vs != in JavaScript

后端 未结 3 1382
南方客
南方客 2020-12-29 20:27

Ok, so I installed Linter on my Sublime editor while working on my node.js app. One of the things that it caught said that I should always use !== to compare an object to nu

3条回答
  •  萌比男神i
    2020-12-29 21:18

    It is even more simple

    var x = null;
        if (x) 6 
        if (!x) 7
    

    the result is

    undefined
    7
    

提交回复
热议问题