myArray = ; // bad
That isn't the optimal way to get a fresh array; to truncate an array, and thus empty it, you should set the length property to zero:
myArray.length = 0; // good!
Setting the length equal to zero empties the existing array, not creating another array! This helps you to avoid pointer issues with arrays as well. With the new array method above:
// ... as provided by Dag in the comments
A = [1,2,3,4,5]
B = A
A = 
console.log(B) // [1,2,3,4,5]
length truncation would make both
B the original array but empty!
Kids these days, I tell ya. All they care about is the technology. The video games. The bottled water. Oh, and the texting, always the texting. Back in my day, all we had was...OK, I had all of these things too. But I still don't get...
Recently I was asked to create a user interface that allows someone to upload an image
to a server (among other things) so that it could be used in the various web sites my
company provides to its clients. Normally this would be an easy task—create a...
Counters. They were a staple of the Geocities / early web scene that many of us "older" developers grew up with; a feature then, the butt of web jokes now. CSS has implemented its own type of counter, one more sane and straight-forward than the ole...