- Undefined is not a type or constant
- Undefined is a type with exactly one value: undefined
- You can get Undefined in various different ways A declared variable without assigning any value to it. Implicit returns of functions due to missing return statements. Return statements that do not explicitly return anything. Lookups of non-existent properties in an object. Function parameters that have not passed. Anything that has been set to the value of undefined
- It means empty or non existent value, it is also used to indicate no value
- It is primitive type and u can use null to assign to any variable. null is not an object it is primitive value
- typeof null returns object. But null is not an object, you cannot add properties to it.
null == undefined – This returns true
null === undefined – This returns false
- The NaN property represents a value that is ‘not a number’. This special value results from an operation that could not be performed either because one of the operands was non-numeric (e.g., ‘abc’ / 4), or because the result of the operation is non-numeric (e.g., an attempt to divide by zero). While this seems straightforward enough, there are a couple of somewhat surprising characteristics of NaN that can result in hair-pulling bugs if one is not aware of them.
- For one thing, although NaN means ‘not a number”, its type is, believe it or not, Number: console.log(typeof NaN === ‘number’); // logs ‘true’
- NaN compared to anything – even itself! – is false: console.log(NaN === NaN); // logs ‘false’