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

Tell us what’s happening:

Help, i cant seem to get to the correct answer! :confused:
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/.

If so, use the concat method to concatenate avatarUrl to avatar. Otherwise return avatar.

This will ensure the avatar URL is correctly formed whether it’s a relative or absolute URL.
my answer:
const userAvatarUrl = avatar.startsWith(/user_avatar/) ? avatarUrl.concat(avatar) : avatar;

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region


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


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

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

Hello, @saldunajose you’re almost there.
The .startsWith() is a string method, so it’s supposed to be used with a string ("")

1 Like

thank you!, i thougth the regex format would be ok

1 Like