Array.prototype.includes vs. Array.prototype.indexOf
tl;dr: NaN is treated differently: [NaN].indexOf(NaN) > -1 is false [NaN].includes(NaN) is true From the proposal: Motivation When using ECMAScript arrays, it is commonly desired to determine if the array includes an element. The prevailing pattern for this is if (arr.indexOf(el) !== -1) { … } with various other possibilities, e.g. arr.indexOf(el) >= 0, or … Read more