@rathore-himanshuSubmitted almost 2 years ago
P
Baptiste DCL
@BaptisteDCLAll comments
- @BaptisteDCLPosted almost 2 years ago
You code is great ! But if i had to be a bit picky and give you advices to get a more efficient javascript, and ultimately code faster, I would've told you to stop creating variables that you only use once like your variable "button". You could have wrote this :
document.querySelector(".button").addEventListener("click", (e) => { if (rating !== undefined) { rating_card.classList.add("hidden"); thank_you_card.classList.remove("hidden"); } const result = document.querySelector(".result"); result.textContent = `You selected ${rating} out of 5`; });
But crazy work nonetheless :)
1