I have created a JS Object which takes name as a key and object as a value,
Const givenMap ={ A:{} }
The value object has a few fields among which givenName = ' '
So i referenced 2 variables to A
const x =givenMap [A]
let y = givenMap[A]
and i assign y.givenName ='Hello'
but for some reason x.givenName is getting assigned as 'Hello' as well, i made sure they weren't referencing or i was assigning the value some where else i even removed code where i was using x in the first place i was just assigning it and not using it anywhere else, my aim is to assign them and later look at each field to check if they have changes in the incoming data which can't be done now since both are getting populated with same value, is there a way we can make sure that x.givenName remains same regardless of what we are assigning to y.givenName