
Design comparison
Community feedback
- @Lukas3162000Posted about 1 month ago
Since i don't have any feedback for you that could improve your code any further (i think its really good and (main part) it works as intended), here's some chatgpt on your code: "Your JavaScript logic is well-structured and effectively fetches JSON data, updates the UI dynamically, and handles navigation. However, there are a few optimizations to improve efficiency and maintainability. First, you have two separate
DOMContentLoaded
event listeners—these should be merged into one to prevent conflicts. Also, selectingdocument.getElementById("hero")
insideupdateSections()
is redundant since it’s always the same element, so move it outside the function. Additionally,box.innerHTML = ""
appears twice, but the first instance is unnecessary and can be removed. To improve error handling, instead of just logging errors to the console, display a message in the UI when the JSON fetch fails. Lastly, renaming variables likewaktu
totimeframe
andprev
topreviousLabel
makes the code more readable. With these fixes, your script will be more efficient, structured, and user-friendly while keeping the same functionality. Great job overall—keep going! 🚀". From my part: great work! :DMarked as helpful1@dharul619Posted about 1 month ago@Lukas3162000 Wow, thank you so much for your appreciation and detailed feedback! I’m really happy to hear that the code works well and can still be optimized. Your suggestions make a lot of sense, especially about merging the event listeners and improving error handling in the UI—it’ll definitely make the code cleaner and more user-friendly. I’ll try to implement these improvements to make it even more efficient. Once again, I really appreciate the positive feedback and encouragement🔥
0
Please log in to post a comment
Log in with GitHubJoin 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