Skip to content
Gallery
JS Fundamentals: Objects, Arrays, and Functions
Share
Explore
Objects & Arrays

icon picker
Exercise: String contains

Prompt

Implement a method, contains that takes and our string data structure and a value and returns true if the data structure contains the value or false if it does not.
Definition: contains(string, value)
Example Usage:
const rooms = 'Billiard Room,Kitchen,Conservatory,Hall,Dining Room';
contains(rooms, "Library"); // => false

contains(rooms, "Hall"); // => true

Code here


Loading…

Solution

The solution is in the solution branch, which can be checked out in the by selecting the version control tab on the right and then selecting the solution branch from the drop down menu.
If you are having trouble with the solutions are also available below.

contains Solution

Next 👉


©2021 for


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.