Tell us what’s happening:
I do not know what I am doing wrong, have I got a space issue. I know this test can also be done with a literal but I stuck to string concatenation ( or at least something similar) as 'string ’ was used in the step instruction.
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 timeAgo = () => {
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 (hours < 24){
return hours + "h ago";
} else {
return days + "d ago";
}
}
};
// 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/141.0.0.0 Safari/537.36 Edg/141.0.0.0
Challenge Information:
Learn Asynchronous Programming by Building an fCC Forum Leaderboard - Step 23