Can you use the [`_.contains`](http://underscorejs.org/#contains) function here? If you don't know about the Underscore library, you should check it out -- it will make your life tons easier.