In the past, it was considered a bad practice to use the following code snippet:
array = [];
This was because if the array was referenced elsewhere, that reference wouldn't be updated correctly.
The recommended approach back then was to use array.length = 0;
However, with JavaScript being updated and the introduction of frameworks like Vue.js,
Vue does not recognize array.length = 0;
for reactivity purposes. Instead, it works with array = [];
So, the question now is: Can we safely use array = [];
in JavaScript, or is it still considered broken?