In Javascript, undefined and null are two different values. Direct comparison of other values ββwith undefined problematic because null == undefined , but typeof null != typeof undefined .
From your comment above, it seems that you explicitly want to check the null and undefined values, in which case you could write (data === undefined || data === null) .
If you want to keep a shorter expression, you can simply write data == null , which is functionally identical. As you mentioned above, you need to provide the option /* jshint eqnull:true */ .
source share