I'm trying to pass one object per parameter of a function, but I do not want that object to change. For this I want to pass a clone parameter.
Because in javascript, by the tests I did, the object is always passed by reference.
Example:
a = {}
b = a;
b.nome = 'Wallace';
console.log(a, b); //Object {nome: "Wallace"} Object {nome: "Wallace"}
See that both objects have changed.
How can I make this assignment from b
to a
in javascript without keeping the references?