@vanzasetia
Posted
Hello there, @ubaydillah77! 👋
Good effort on this challenge! 👍
Never use div
for interactive elements. The general rule of thumb is to always use interactive elements for anything that is interactive. In this case, you can use the native HTML element to create the accordion which is details
and summary
. By default, they are accessible by keyboard and screen readers and have open and close functionality. However, you can still create functionality that only allow the user to only open one accordion panel at a time to prevent the card from having a lot of height.
Also, I would recommend using forEach
instead of the traditional for loop
. This way, your code looks modern and much shorter compare to for loop
.
That's it! Hope this helps. 😊