Implement basic promises#1559
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because src/scripts/main.js correctly implements all of the core task requirements. You created two promises (promise1 and promise2), wired promise1 to resolve on .logo click, and set promise2 to reject after 3 seconds, as specified. Both promises have appropriate .then and .catch handlers that append the correct <div> elements to document.body with the required classes and texts for success and error cases. From a functional standpoint, there are no critical issues that would block task completion or break the described behavior.
One small, non-blocking improvement you could consider is adding a null check around the .logo element query before attaching the click listener, to avoid potential runtime errors if the element is missing in some environments:
const logo = document.querySelector('.logo');
if (logo) {
logo.addEventListener('click', () => resolve());
}Overall, the implementation is clear, meets the task’s functional requirements, and is good to move forward.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Implemented basic promises task.
DEMO LINK: https://AntonyShaga.github.io/js_promise_basic_DOM/