includes
Return true if a value is in a DefineList.
list.includes(itemToFind[, fromIndex])
It uses Array.prototype.includes
, an error will be thrown if it is not supported by the environment (Internet Explorer) and no polyfill is found.
import {DefineList} from "can";
const list = new DefineList(["a", "b", "c"]);
console.log(list.includes("a")); // true
console.log(list.includes("foo")); // false
console.log(list.includes("c", -100)); // true
console.log(list.includes("b", 100)); // false
Parameters
- itemToFind
{*}
:The item to find in the
list
. - fromIndex
{*}
:The position in the
list
at which to begin searching foritemToFind
.
Returns
{Boolean}
:
false
if itemToFind
is not found in the list
, true
otherwise