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

Tell us what’s happening:

The explanation wants to user to create "
return “xm ago”
"
See explanation: return the string “xm ago”

Which doesnt make sense. I found the right way by checking the forum. Why do you want me to write "return “xm ago” "?

Your code so far

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

/* file: styles.css */

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

const timeAgo = (time) => {
  const currentTime = new Date();
  const lastPost = new Date(time);
  const minutes = Math.floor((currentTime - lastPost) / 60000)
  const hours = Math.floor((currentTime - lastPost) / 3600000)
  const  days = Math.floor((currentTime - lastPost) / 86400000)

  if (minutes < 60) {
    return `${minutes}m ago`
  } else if (days < 24) {
    return `${hours}h ago`
  } else {
    return `${days}d ago`
  }
  
};

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1.1 Safari/605.1.15

Challenge Information:

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

That function will be used to calculate the timestamp for the posts, so if now it is 8pm and the post was created at 7:12pm, your function should create the string "48m ago"

I understand what they wanted from the beginning but its saying RETURN the STRING “XM AGO”
See whats between the quotes? “XM” and “AGO”. I cant be the only one thats thinking they want you to write “XM AGO” after RETURN.
Should it be hinting you towards writing AT LEAST “m ago” ??? or x “m ago” ??? come on man.

the X is a placeholder for the number, see the next sentence

Are you a bot? I’m genuinely asking because I wrote that I understand the issue and wrote the issue with bold letters. FCC is asking you to write “XM AGO” in between the double quotes.

  • If the amount of minutes that have passed is less than 60, return the string "xm ago". x will represent the minutes.
  • If the amount of hours that have passed is less than 24, return the string "xh ago". x will represent the hours.
  • Otherwise, return the string "xd ago". x will represent the days.

It tells you what x is.

Thank you I did not see that!

Question, did you read: return the string “xm ago”
Where FCC literally tells you to write the string "xm ago" instead of telling you to write x "m ago". As I’m trying to explain. I can understand that “xm” just means x amount of minutes but that does not make sense if youre telling the user to literally write.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

Using “x”, or “n”, or some other letter as a placeholder is common practice. For numbers, using “#” is fairly common as well. It tells you what the placeholder represents right after it.

Some examples:

  • Return the string "x was rolled". x represents the random number you generated.

  • Return the string "n is not a passing score". n represents the score you calculated.

  • Return the string "# is not a valid input". # represents the number the user gave as an input.


Anyway, if you think it can be clarified better, we are always open for changes and suggestions.

1 Like