Tell us what’s happening:
I am returning the forums correctly except for the general category. It says everything is right except the href. I just can’t see what’s wrong
Your code so far
<!-- file: index.html -->
/* file: styles.css */
const forumLatest =
'https://cdn.freecodecamp.org/curriculum/forum-latest/latest.json';
const forumTopicUrl = 'https://forum.freecodecamp.org/t/';
const forumCategoryUrl = 'https://forum.freecodecamp.org/c/';
const avatarUrl = 'https://cdn.freecodecamp.org/curriculum/forum-latest';
const allCategories = {
299: { category: 'Career Advice', className: 'career' },
409: { category: 'Project Feedback', className: 'feedback' },
417: { category: 'freeCodeCamp Support', className: 'support' },
421: { category: 'JavaScript', className: 'javascript' },
423: { category: 'HTML - CSS', className: 'html-css' },
424: { category: 'Python', className: 'python' },
432: { category: 'You Can Do This!', className: 'motivation' },
560: { category: 'Backend Development', className: 'backend' }
};
const example1 = new Date("December 17, 2025 00:00:00");
const isoExample = example1.toISOString();
function timeAgo(timestamp){
let currentTimeMs = Date.now();
let postDateMs = new Date(timestamp).getTime();
let timeAgoMs = currentTimeMs - postDateMs;
let timeAgoSec = Math.floor(timeAgoMs / 1000);
let timeAgoMin = Math.floor(timeAgoSec / 60);
let timeAgoHour = Math.floor(timeAgoMin / 60);
let timeAgoDay = Math.floor(timeAgoHour / 24);
switch (true) {
case timeAgoDay > 0:
return timeAgoDay + "d ago";
case timeAgoHour > 0:
return timeAgoHour + "h ago";
case timeAgoMin > 0:
return timeAgoMin + "m ago";
case timeAgoSec > 0:
return timeAgoSec + "s ago";
};
}
function viewCount(views){
switch (true) {
case views < 1000:
return views;
case views < 10000:
return String(views)[0] + "k";
case views < 100000:
return String(views).slice(0,2) + "k";
case views < 1000000:
return String(views).slice(0,3) + "k";
case views > 999999:
return String(views).slice(0,1) + "m";
};
}
function forumCategory(categoryNum){
if(allCategories.hasOwnProperty(categoryNum)){
return `<a class="category ${allCategories[categoryNum].className}" href="${forumCategoryUrl}${allCategories[categoryNum].className}/${categoryNum}">${allCategories[categoryNum].category}</a>`;
} else {
return `<a class="category general" href="${forumCategoryUrl}general/200">General</a>`;
};
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0
Challenge Information:
Build an fCC Forum Leaderboard - Build an fCC Forum Leaderboard