var test = function ()
{
var my_array =[1,2,3];
my_function = function (my_array)
{
my_array = global_fun().slice();
console.log(my_array.length); // >> 10 !!!!!!
}
my_function (my_array);
console.log(my_array.length); // >> 3 !!!!!!
// my_array keeps being 1,2,3
}
var global_fun = function ()
{
var array =[];
array=[9,8,7,6,5,4,3,2,1,0];
return array;
}
Please, copy this code and run test(); You can see how my_array keeps being the same .
Why this does not work ? I dont want to push values, I want a complete array change.
I feel like a st....