Maybe the question already exists, but I don't find anything because I don't know how to call this problem.
I have an object function and want to assign the object variable into a variable:
this.myFunction = function() {
    var selection;                // internal variable
    selection = this.selection;   // both are [0,0]
    console.log(this.selection);  // result: [0,0]
    selection[0] = 500;           // set internal variable[0] 500
    console.log(selection);       // result: [500,0]
    console.log(this.selection);  // result: [500,0] <-- expected: [0,0]
}
How I can change the local variable without changing the other?
 
     
     
    