Learn Asynchronous Programming by Building an fCC Forum Leaderboard - Step 61

I think I’m using the incorrect method for the beginning of my ternary operator but I’m not sure what other method to use. Here are the instructions:

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.

And here is my current code:

const userAvatarUrl = avatar.startsWith(/user_avatar/) ? avatar.concat(avatarUrl) : avatar;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Asynchronous Programming by Building an fCC Forum Leaderboard - Step 61

Welcome to the forum @skylar.herms

image

Nest the regex in quote marks.

Check the order of what you are concatenating.

Happy coding

Thank you! Such a silly mistake to make but I was very frustrated!

1 Like