solution#1518
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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! ✨
DEMO LINK