Primitive Data Types

Video

JavaScript Notes

JavaScript
    // Primitives and Objects
    // Data Types in JS
    // booleans, null, undefined, number, string, symbol - 6 types of primitives
    // Objects – everything else is an object (generic objects, array objects, string objects, etc.)
    
    let nm = 'bob';	                // String literal
    let nm2 = new String('bob');	// String object
    
    nm2.toUpperCase( );
    nm.toUpperCase( );	            // even through this is a string literal, JS ‘autoboxes this into an Object, so that the .toUpperCase method can be accessed
    
    // Objects
    let o = new Object( );	        // object constructor syntax 
    let o = {	                    // object literal syntax
        prop1: 1, 
        prop2: false,
        prop3: 'string',
        prop4: function( ) {
            // this method, is an object of type: function
        }
    };
    // auto-boxing – putting a primitive value into a wrapper of the correct type