The new solution
As of 2015, browsers support Array.prototype.includes (caiuse, MDN) and with this you don't need to use indexOf.
if (['item1', 'item2'].includes(variable)) { // logic }