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