includes方法可以检测出数组中是否包含 NaN元素,而indexOf并不能识别出NaN。
const tmp = [1, 9, false, NaN]; tmp.includes(NaN); // true tmp.indexOf(NaN); // -1