Skip to content

Commit

Permalink
Add example to iterators practice
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylagordon committed Mar 21, 2024
1 parent 2f220ce commit 2884dec
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion lessons/module-2/approaching-problems-many-ways.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,47 @@ tags: prototype methods
## Activity

### Set Up
- Fork [this replit]()
- Open up a new replit.
- Here is your starter code for your replit:
```js
const ninetiesToys = [
{
name: "Tamagotchi",
releaseYear: 1996,
price: 15.99
},
{
name: "Furby",
releaseYear: 1998,
price: 29.99
},
{
name: "Super Soaker",
releaseYear: 1989,
price: 19.99
},
{
name: "Pogs",
releaseYear: 1991,
price: 5.99
},
{
name: "Game Boy",
releaseYear: 1989,
price: 89.99
}
];
```
- We will be solving the same challenge three times today. Each time, you will be told with iterator method(s) you're allowed to use.

<section class="note">
### The Prompt!

Write a function `findCheapToys` that returns an array of toy names that cost less than $20.

Expect output => `[ 'Tamagotchi', 'Super Soaker', 'Pogs' ]`
</section>

### Round 1: `forEach`
- Solve the prompt using a `forEach`. You may not use any other iterator methods.

Expand Down

0 comments on commit 2884dec

Please sign in to comment.