This is the data that has a single value and no additional methods or properties. E.g. String, Number, Boolean, Undefined, and Null. These data types are passed by value.
2. Reference Values
When we assign a primitive value to a variable, the actual data is stored in a memory called the “STACK” and the variable holds…