1
How can I give a Object.freeze
in just one object?
Follow example below where I create a
, replicatic a
in b
, freezo the b
, and I try to re-assign a value to a
. But it’s no longer possible. Why? How do I freeze on just one object?
Thank you!
let a = { "teste" : [1,2,3] }
// Quero 'b' freezado
const b = a;
Object.freeze(b);
a.teste = [4,5,6]
// 'a' não foi freezado e mesmo assim não consigo alterar o valor dele
console.log(a)
Perfect guy, Thank You!! Saved my ass!
– Jackson