I've got an Array:
var Arr = [1, 4, 8, 9];
At some point later in the code this happens:
Arr.push(someVar);
Here instead of pushing a new value, I want to replace the entire contents of Arr
with someVar
. (i.e. remove all previous contents so that if I console.logged() it I'd see that Arr = [someVar]
How could this be achieved??