mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-27 11:01:38 -04:00
fix(curriculum) updated text and added new conditions to tests (#53800)
This commit is contained in:
@@ -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--
|
||||
|
||||
Reference in New Issue
Block a user