fix(curriculum): correct instructions, add quotes around value (#54406)

This commit is contained in:
Lasse Jørgensen
2024-04-16 06:51:04 +02:00
committed by GitHub
parent ead58e878a
commit b4bae84bfd

View File

@@ -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/));