Tell us what’s happening:
What;s wrong with this function?
function avatars(posters, users) {
return users
.map((user) => {
const poster = posters.find((p) => p.user_id === user.id);
if (!poster || !poster.avatar_template || !poster.name) {
return '';
}
let src = poster.avatar_template.replace('{size}', '30');
if (!src.startsWith('http')) {
src = `${avatarUrl}/${src}`;
}
return `<img src="${src}" alt="${poster.name}" />`;
})
.join('');
}
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
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.6 Safari/605.1.15
Challenge Information:
Build an fCC Forum Leaderboard - Build an fCC Forum Leaderboard