Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

faq-accordion-card HTML, CSS, JS, flexbox

coc0dev 190

@coc0dev

Desktop design screenshot for the FAQ accordion card coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I welcome any feedback!

Community feedback

@Eileenpk

Posted

Excellent work, your code is very clean! Could you have used a forEach instead of running a loop on dropDown?

dropDown.forEach((el) => { el.addEventListener('click', () => { if (el.classList.contains('active')) { dropDown.forEach((drop, index) => { el.classList.remove('active') }) } else { dropDown.forEach((drop, index) => { dropDown[index].classList.remove('active') }) el.classList.add('active') } }) })

Marked as helpful

0

coc0dev 190

@coc0dev

Posted

@Eileenpk Hi Eileen, I agree that is a little cleaner instead of switching loop styles. Thanks for pointing that out!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord