Skip to content

solution#1518

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

solution#1518
aakash1sadhu wants to merge 1 commit into
mate-academy:masterfrom
aakash1sadhu:develop

Conversation

@aakash1sadhu
Copy link
Copy Markdown

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Your solution is approved because it correctly implements both promises, wires promise1 to resolve on .logo click, has promise2 reject after 3 seconds, and attaches appropriate .then and .catch handlers that append the required DOM elements with the exact texts and CSS classes. The success handler properly creates a <div class="message"> with Promise was resolved!, and the error handler creates a <div class="message error-message"> showing Promise was rejected!, so all functional requirements are met. One small robustness improvement to consider in src/scripts/main.js is guarding the line where you do const logo = document.querySelector('.logo') before calling logo.addEventListener(...); if .logo is missing in the DOM, logo will be null and addEventListener would throw a runtime error [CHECKLIST ITEM #2]. A simple pattern is:

const logo = document.querySelector('.logo');
if (logo) {
  logo.addEventListener('click', () => {
    // resolve promise1 here
  });
}

This tweak isn’t required for passing the task but will make your code safer in different page setups. Overall, nice work keeping the implementation concise and readable while meeting all the stated requirements.


✨ 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