Cool -- there's a built-in function in underscore.js (which we use) that can do this too (possibly more efficiently):
http://underscorejs.org/#uniq