fix(curriculum) updated text and added new conditions to tests (#53800)

This commit is contained in:
Mikey Esteban
2024-02-21 02:45:42 -05:00
committed by GitHub
parent 9c0dd19f77
commit c4f7549711

View File

@@ -7,22 +7,22 @@ dashedName: step-34
# --description--
Within the arrow function of the event listener, add an `if` to check if `userData?.currentSong` is `null`.
Within the arrow function of the event listener, add an `if` to check if `userData?.currentSong` is `falsey`.
Inside the `if` block, call the `playSong()` function with the `id` of the first song in the `userData?.songs` array. This will ensure the first song in the playlist is played first.
# --hints--
You should create an `if` statement with the condition `userData?.currentSong === null`.
You should create an `if` statement with the condition `!userData?.currentSong`.
```js
assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{/)
assert.match(code, /if\s*\((\s*\!userData\?\.currentSong\s*|\s*userData\?\.currentSong\s*===\s*null\s*|\s*userData\?\.currentSong\s*===\s*undefined\s*)\)\s*\{/)
```
You should call the `playSong` function with `userData?.songs[0].id` inside your `if` block.
```js
assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}/)
assert.match(code, /if\s*\((\s*\!userData\?\.currentSong\s*|\s*userData\?\.currentSong\s*===\s*null\s*|\s*userData\?\.currentSong\s*===\s*undefined\s*)\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}/)
```
# --seed--