How do you want to empty an array in Javascript? Previously, I used to
var arr = [1, 2, 3, 4];
arr = [];
However this method has a big flaw in referencing.
arrB = arr; // arrB = [1, 2, 3, 4]
arr = []; // arr = [], arrB = [1, 2, 3, 4]
According to [1], there are a number of alternative to empty an array. I prefer:
arr.length = 0; // arr = [], arrB = []