# Special Values in Javascrit ###### tags: `javascript` `NaN` `null` `undefined` ### undefined - Default value of uninitialized variables - You shouldn't assign undefined as a value manually ```javascript var myVar; console.log(typeof myVar) //undefined ``` ### null - Never assumed by default - You can assign this is a value if you want to "reset"/"clear" a variable Interestingly, null has a data type of object ```javascript var myVar = null; console.log(typeof myVar) //object ``` ### NaN - **NaN is not a type** - Technically, it's of type number and can therefore be used in caculations - It yields a new NaN and it's the result of invalid cavulations (eg, 3 * 'hi') ### How about empty? - empty simply means empty string ```javascript var myVar = ""; console.log(typeof myVar) //string ``` ### Are they equal? - It's different between === and == - Null and undefined mean "nothing" value ```javascript console.log(null == undefined) // true ``` - Even null and undefined mean "nothing" similarly, the types between them are differnet ```javascript console.log(null === undefined) // false ``` ```javascript console.log(null == undefined) // true console.log("" == null); // false console.log("" == undefined); // false console.log("" === null); // false console.log("" === undefined); // false ```