I started taking the course Accelerated JavaScript Training by Maximilian in Udemy and I found very interesting the why he explained the difference between those types in JavaScript, so I decided to write about that.
In JavaScript variables can have different types, but those types can be categorize into categories: Primitive and Reference.
Primitives
Primitive are simple types like Boolean, String and Number.
When you copy a primitive, then the new variable will actually be a copy of that one. This means that if you change the first variable, the second variable (the copy one) will not be changed.

You can do this example in your browser console.
Reference Types
Reference Types are more complex ones like Object or Array.
When it comes to Reference Types, what we have is not a copy of the variable. In this case the variable doesn’t actually store the data but it only stores a pointer to a place in memory, where data is stored.
Therefore, if you copy a reference type variable, you copy the pointer. If you change the value of the first variable, the value of the second one will also be changed since you changed the data in the memory. The pointer is still the same.

So if we try to check if ArrayA is equal to arrayB, we it will be true, but in a case that we create a new array ArrayC with exactly the same values as ArrayA and we check for equality, we will get false.

Because in ArrayC case, we also create a value, an array and we store this in memory too. It’s not the same storage place as arrayA, since a new array was created. We know that is exactly the same, but JavaScript doesn’t. And that is a good thing because we can add a new value to this array and all of a sudden it wouldn´t be the same anymore.
When we are comparing the objects, we are actually comparing the pointers, and the pointers, point to different locations in memory.
