Fill: toContain
Fill in the Blank Easy
Question
Fill in the blank to check if the array contains 'apple':
Code
test('has apple', () => {
expect(['apple', 'banana']).___('apple');
});
Hint
The matcher name means 'contains this item'.
Explanation
The correct answer is toContain. This matcher checks whether the received array (or string) contains the expected element (or substring). Since 'apple' is in the array, the assertion passes.
Related Resources
Related Lessons
- Jest Basics
Getting started with Jest.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.