mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 01:00:13 -04:00
fix(curriculum): correct instructions, add quotes around value (#54406)
This commit is contained in:
@@ -9,11 +9,11 @@ dashedName: step-61
|
||||
|
||||
Next, you will construct the `userAvatarUrl`.
|
||||
|
||||
Start by creating a constant called `userAvatarUrl`. Then use a `ternary` operator to check if `avatar` starts with `/user_avatar/`.
|
||||
Start by creating a constant called `userAvatarUrl`. Then use a `ternary` operator to check if `avatar` starts with `"/user_avatar/"`.
|
||||
|
||||
If so, use the `concat` method to concatenate `avatarUrl` to `avatar`. Otherwise return `avatar`.
|
||||
If so, use the `concat` method to concatenate `avatar` to `avatarUrl`. Otherwise return `avatar`.
|
||||
|
||||
This will ensure the avatar URL is correctly formed whether it's a relative or absolute URL.
|
||||
This will ensure the avatar URL is correctly formed whether it's a relative or absolute URL.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -23,7 +23,7 @@ You should have a constant named `userAvatarUrl`.
|
||||
assert(code.match(/const\s+userAvatarUrl\s*=/));
|
||||
```
|
||||
|
||||
You should assign a `ternary` operator to the `userAvatarUrl`. Your `ternary` should check if `avatar` starts with `/user_avatar/` and return `avatarUrl.concat(avatar)` or `avatar`.
|
||||
Your `ternary` should check if `avatar` starts with `"/user_avatar/"` and return `avatarUrl.concat(avatar)` or `avatar`.
|
||||
|
||||
```js
|
||||
assert(code.match(/const\s+userAvatarUrl\s*=\s*(?:avatar\.startsWith\(\s*('|")\/user_avatar\/\1\s*\)|\/\^\\\/user_avatar\\\/\/\.test\(\s*avatar\s*\))\s*\?\s*avatarUrl\.concat\(\s*avatar\s*\)\s*:\s*avatar/));
|
||||
|
||||
Reference in New Issue
Block a user