Design comparison
SolutionDesign
Solution retrospective
I was trying to come up with a way to forEach the buttons and use each buttons classList.value as the template string filler for innerText.current and .previous, eg. JS15(data[i]).timeframes.(classList.value).current), thinking I could eliminate the if statements and get DRY, but then daily and monthly previous would say 'Last week - '. So I figured I'd stick with what I've done.
If that makes sense to anyone else and there is a way to do it without each previous value including 'Last week - ', please let me know. Cheers!!
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