indexOf
Look for an item in a DefineList.
list.indexOf(item)
indexOf finds the first index position of a given item in the DefineList.
import {DefineList} from "can";
const list = new DefineList(["Alice", "Bob", "Eve"]);
console.log(list.indexOf("Alice")); //-> 0
console.log(list.indexOf("Charlie")); //-> -1
Parameters
- item
{*}:The item to find.
Returns
{Number}:
The index of the item in the DefineList, or -1 if the item is not found.