SQL:
something in ('X','Y','Z','0')
Modern JavaScript (including IE>8):
['X','Y','Z','0'].indexOf(something)>-1
More Modern JavaScript (!IE):
['X','Y','Z','0'].includes(something)
If you need a simple includes
polyfill for legacy browsers (including IE):
if(!Array.prototype.includes) Array.prototype.includes =function(value,start) {
start=parseInt(start)||0;
for(var i=start;i<this.length;i++) if(this[i]==value) return true;
return false;
};
In deference to AuxTaco’s comment, here is a version of the polyfill which works for IE>8:
if (!Array.prototype.includes) Object.defineProperty(Array.prototype, 'includes', {
value: function(value,start) {
start=parseInt(start)||0;
for(var i=start;i<this.length;i++) if(this[i]==value) return true;
return false;
}
});