08_PASS BY REFERENCE VS PASS BY VALUE ( PRIMITIVE VS NON_PRIMITIVE / REFERENCE VALUE)
JavaScript is dynamically typed language which means types are not defined at compile time like other object-oriented languages. JavaScript provides two categories under which the data types are divided. Primitive Values Reference Values Primitive Values: In JavaScript, a primitive is data that is not an object and has no methods. There are 7 primitive data types: string, number, boolean, null, undefined, symbol, biginit. Most of the time, a primitive value is represented directly at the lowest level of the language implementation. All primitives are immutable, i.e., they cannot be altered. It is important not to confuse a primitive itself with a variable assigned a primitive value. The variable may be reassigned a new value, but the existing value cannot be changed in the ways that objects, arrays, and functions can be altered.” - Source - MDN To break the above definition, it simply means that in case of primitive values, it creates and assigns a fixed locat...