Tell me what I could have done better or what you think I should change. Also... I am not very familiar with using setTimeout(). I have implemented it in my JS but I don't want it to constantly run, is there a way to only have the timeout run after the submit button is pressed? Or if there is a better way to have a preset timout. Thanks in advance for your help.
Marcin
@marcinsuskiAll comments
- @CrypticMangoSubmitted about 2 years ago@marcinsuskiPosted about 2 years ago
Your code is neat and pleasant to read, I'm still learning that particular skill ;)
As for JS, You wrote loads of code to target each rate individually. I think I did it more efficient by targeting whole class of buttons (parent div) and using 'forEach' function. It took me 1 line of code this way:
const rates = document.querySelectorAll('.btn');
rates.forEach((rate) => { rate.addEventListener('click', () => { result.innerHTML = rate.innerHTML }) })
setTimeout() looks good - did You make any updates on it?
Marked as helpful0