I couldn't remember how to clone arrays in JavaScript, so I did a quick search for the answer.
I found some, uh, not-so-great answers, mainly involving writing custom copy functions that iterated over every item in the array to copy it.
Turns out there already exists a method in JavaScript 1.2+ (in other words, in all major browsers) to clone arrays. It's called, helpfully enough, slice(begin[,end])
.