Skip to content

Implement basic promises#1559

Open
AntonyShaga wants to merge 1 commit into
mate-academy:masterfrom
AntonyShaga:develop
Open

Implement basic promises#1559
AntonyShaga wants to merge 1 commit into
mate-academy:masterfrom
AntonyShaga:develop

Conversation

@AntonyShaga

Copy link
Copy Markdown

Implemented basic promises task.

  • promise1 resolves on logo click
  • promise2 rejects after 3 seconds
  • added success and error handlers
  • added DOM messages for resolved/rejected states

DEMO LINK: https://AntonyShaga.github.io/js_promise_basic_DOM/

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants