Nope. If you had another reference to the original array, the original array would still remain at the other reference - you have done nothing to the original array.
Compare:
letnumbers=[1,3,5,7,9];letnumbers_b=numbers;// another reference to same arraynumbers.length=0;console.log(numbers_b);// []
And:
letnumbers=[1,3,5,7,9];letnumbers_b=numbers;// another reference to same arraynumbers=[];console.log(numbers_b);// [1, 3, 5, 7, 9]
Assigning to an empty array does exactly that - assigns a new array to the variable. Entirely different to emptying an existing array. 'Emptying' an array by simply overwriting it with a new empty array could easily cause unexpected problems.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nope. If you had another reference to the original array, the original array would still remain at the other reference - you have done nothing to the original array.
Compare:
And:
Assigning to an empty array does exactly that - assigns a new array to the variable. Entirely different to emptying an existing array. 'Emptying' an array by simply overwriting it with a new empty array could easily cause unexpected problems.