I need one clarification java script. I used two variables in my program. I stored particular array in first variable and again create one variable. I have stored second variable value in first variable.Then I pushed one vale in second variable... If i print first variable means second variable vale displayed.. My expectation is first variable value don't want to change..
// first variable
var test = ["a","b","c"];
// second variable
var arr = test;
arr.unshift("d");
// second variable print
console.log(arr); // ["a","b","c","d"]
// First variable print
console.log(test); // ["a","b","c","d"]
// I want to maintain first original value
// Expectation result
console.log(test); // ["a","b","c"]
I need maintain original value in first variable..What I do?