0
var test = ["test", "test", "test"];
        
var temp = test;
        
temp[0] = "change";
        
console.log(test); // ["change", "test", "test"]

When I copy a global variable to a temporary variable and change the temporary variable, the global variable changes.

I don't want to change the global variable value. I only want to get the value and use it.

What should I do?

0 Answers0