Searching and Sorting Lists
Find, contains, indexOf, and sort.
Finding Things
Lists give you quick ways to ask questions about their contents, like whether an item exists or where it sits. Let us explore searching. 🔍
Does It Contain?
The contains method returns true or false, telling you whether a value lives somewhere in the list.
var pets = ['cat', 'dog'];
print(pets.contains('dog')); // trueAll lessons in this course
- Creating Lists and Indexing
- Adding, Removing, and Updating Items
- Searching and Sorting Lists
- Transforming With map, where, and toList