About 71,500 results
Open links in new tab
  1. What is the difference between null and undefined in JavaScript?

    Feb 22, 2011 · The difference between null and undefined is: JavaScript will never set anything to null, that's usually what we do. While we can set variables to undefined, we prefer null …

  2. JavaScript checking for null vs. undefined and difference between ...

    Feb 24, 2011 · (There's a difference between an object not having a property, and having the property with the value undefined; there's a difference between calling a function with the …

  3. difference between null and undefined in JavaScript?

    Aug 31, 2012 · According to What is the difference between null and undefined in JavaScript?, null and undefined are two different objects (having different types) in Javascript. But when I …

  4. How to check for an undefined or null variable in JavaScript?

    While literally using the keyword undefined, Boolean(undefined) works, trying that with an undefined variable doesn't work, and that is the whole point of doing the check for null or …

  5. What reason is there to use null instead of undefined in JavaScript ...

    Jul 7, 2011 · Variables var a; and function return values default to undefined. In the past null was in the global scope so using it slowed execution and led me to prefer other falsy types (false, '', …

  6. Comparing to null - !== vs != in JavaScript - Stack Overflow

    Apr 25, 2013 · Ok, so after reading through the comments and looking at my code, I have learned that !== can have issues if the object is undefined rather than null (see this post: Why is null an …

  7. When is null or undefined used in JavaScript? - Stack Overflow

    However, because of the advantage that null cannot be redefined, I might would use it when using ==. For example, variable != null will ALWAYS return false if variable is equal to either null or …

  8. The difference between `typeof x !== "undefined"` and `x != null`

    I can't find any difference between typeof somevar == 'undefined' and typeof somevar === 'undefined', because typeof always returns string. For null it will return 'object'. Or could be that …

  9. What is the difference between Null, NaN and undefined in …

    May 14, 2018 · There are many ways that you can generate this error, one being invalid math opertaions such as 0/0 or sqrt (-1) undefined: It means that the object doesn't have any value, …

  10. Speed of comparing to null vs undefined in JavaScript

    The test declares a variable, but doesn't assign anything to it: var x; It then compares the speed of comparing the value variable to null, and to undefined, in other words: var y = (x == null); and …

Refresh