In this part we are going to talk about primitive and rare fitness a wearable can hold one of the two
radical types which is primitive rarely used or reference or rather you primitive.
Well do we still value stored with outside by where it is and the reference is the value store that
we have aside by reference.
But what is the difference.
Let's take an example for example.
Now we are going to clear a variable name which is equal to Sam and then we create another copy which
is equal to a name.
So now we are going to clean out the result.
This is not surprising because name copy is equal to a name.
But now we are going to change the name to another for example.
Now is equal to Mary
after the change of the name.
We see the result is like this name is equal to Mary but on them copy is still the same.
This has to be called name copy.
We will not be affected because of the change of the name.
Let's take a lot of time reference type.
Now we create a user
which only have the name properties which is Mike.
And then we create another copy.
Does that copy is equal to user.
Now again we are going to appear now.
We s
again you can see that you saw is as expected because you use a copy is equal to a user.
But now when we try to adjust the name of might become Mary for example.
Do as I thought name is equal to Mary
now you can see auto use a copy do not change it just echo to use it.
It also will be changed that because of the user name is changed to Mary.
So what can we do if we really want to create a copy of user.
We can use the spread operator for some poll in the state of equal to a user.
We can change to portable user.
And now you can see immediately.
Although the name of the user is changed and the name of the user a copy will not be changed.
So this is the defense of permitted type and a reference type and how you beauty make a copy from an
object.