export default function includes(searchElement, searchList, fromIndex) {
Copyright 2015-2021 JC Fisher
export default function includes(searchElement, searchList, fromIndex) {
if (searchList == null) {
throw new TypeError('"searchList" is null or not defined');
}
var o = Object(searchList);
var len = o.length >>> 0;
if (len === 0) {
return false;
}
var n = fromIndex | 0;
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
function sameValueZero(x, y) {
return (
x === y ||
(typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y))
);
}
while (k < len) {
a. Let elementK be the result of ? Get(O, ! ToString(k)). b. If SameValueZero(searchElement, elementK) is true, return true. c. Increase k by 1.
if (sameValueZero(o[k], searchElement)) {
return true;
}
k++;
}
return false;
}