数组的includes方法
  Array.prototype.MyIncludes = function (value, start = 0) {
    if (start < 0) start = this.length + start
    const isNaN = Number.isNaN(value)
    for (let i = start; i < this.length; i++) {
        if (this[i] === value || Number.isNaN(this[i]) === isNaN) {
            return true
        }
    }
    return false
}
 1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10