JSFiddle - React, Tailwind, and code Playground

oop: Ch1-Primitive&ReferenceTypes

by nickadeemus2002

JavaScript

/**
 * OOP: ch.1
 * =====================================================
 * Encapsulation - 
 *	Data can be grouped together with functionality 
 *	that operates on that data. 
 *
 * Aggregation - 
 *	One object can reference another object.
 *
 *	Inheritance - 
 *	A newly created object has the 
 *	same characteristics as another object
 *	without explicitly duplicating its functionality.
 *
 *	Polymorphism -
 *	One interface may be implemented by multiple objects.
 *	It is the practice of designing objects to share 
 *	behaviors and to be able to override shared 
 *	behaviors with specific ones.
 *
 */


/**
 * 	Primitive types are stored as simple data types. 
 * 	
 *		Reference types are stored as objects,
 *		which are really just references to locations in memory.
 *
 *		The tricky thing is that JavaScript lets you treat 
 *		primitive types like reference types in order to
 *		make the language more consistent for the developer.
 *
 */

/*
 * PRIMITIVE Types:
 * =====================================================
 * 	Boolean - 
 *		true or false;
 *
 *		Number - 
 *		Any integer or floating-point numeric value;
 *
 *		String - 
 *		A character or sequence of characters delimited 
 *		by either single or double quotes;
 *		(JavaScript has no separate character type)
 *
 *		Null - 
 *		A primitive type that has only one value, null;
 *
 *		Undefined - 
 *		A primitive type has only one value, 
 *		undefined (undefined is the value
 *		assigned to a variable that is not initialized);
 *
 *
 *  	When you assign a primitive value to a
 *		variable, the value is copied into that variable. 
 *		This means that if you set one variable equal to
 *		another, each variable gets its own copy of the data.
 *
 */


//native string
var daughter1 = "Makayla";
//gets copy of daughter1
var daughter2 = daughter1;
console.log('*** daughter2 COPY of daughter 1 ***');
console.log('daughter1 => ', daughter1);
console.log('daughter2 => ', daughter2);


//value update won't...