I have this structure:
var a = [];
a.push({"level": 1, "column": 4, "parent": "none", "title": "Node 0", "content": "Parintele suprem", "show": "1"});
var b = a;
a.push({"level": 1, "column": 5, "parent": "none", "title": "Node 1", "content": "Parintele suprem", "show": "1"});
console.log(b);
Now the problem is that b
has the exact content as a
(the content after the second push). This suggest (correct me if I'm wrong) that when I said b = a
I actually gave b same reference as a, so whatever I do in a
I have in b
. The thing is that I need to pass the value. So I have the previews a
, value in b
.
Edit to make the question more clear: How do I pass the value instead of the reference?