I used `length` based on this thread on StackOverflow: http://stackoverflow.com/questions/1232040/how-to-empty-an-array-in-javascript.