Null vs Undefined

Video

JavaScript Notes

JavaScript
    // null and undefined in JS
    // null means nothing, void, emptiness
    // and is intentionally set
    // undefined means container exists
    // but hasn’t been given a value yet
    // functions with no return statement
    // will return undefined by default
    
    var x;
    console.log(x);  // returns undefined
    
    function abc( ) {
         // nothing here
    }
    console.log( abc( ) );   // returns undefined
    
    console.log(typeof null);		// “object”
    console.log(typeof undefined);		// “undefined”
    console.log(null === undefined);		// false (object equivalency)
    console.log(null == undefined);		// true (value equivalency)
    console.log(null === null);		// true (object equivalency)
    console.log(null == null);		// true (value equivalency)
    console.log(undefined === undefined);	// true (object equivalency)
    console.log(undefined == undefined);	// true (value equivalency)
    console.log(!null);			// true
    console.log(isNaN(1 + null));		// false
    console.log(isNaN(1 + undefined));	// true