Skip to content

Открывается и закрывается#8

Merged
keksobot merged 4 commits intohtmlacademy-javascript:masterfrom
Kate1jkee:module8-task1
Apr 5, 2026
Merged

Открывается и закрывается#8
keksobot merged 4 commits intohtmlacademy-javascript:masterfrom
Kate1jkee:module8-task1

Conversation

@Kate1jkee
Copy link
Copy Markdown
Contributor

@Kate1jkee Kate1jkee commented Apr 2, 2026

@keksobot keksobot changed the title Module8 task1 Открывается и закрывается Apr 2, 2026
Comment thread js/createObjects.js

while (messages.some((mes) => mes === message)) {
message = getRandomArrayElement(MESSAGE);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Перенос строки

Comment thread js/createObjects.js
message = getRandomArrayElement(MESSAGE);
}
messages.push(message);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Перенос строки

Comment thread js/createObjects.js
Comment thread js/createObjects.js
id: countIdComment(),
avatar: `img/avatar-${getRandomPositivInteger(1, 6)}.svg`,
message: choseMessage(),
message: choseMessage(2),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Волшебное число

Comment thread js/imageModal.js Outdated
*/
pictureContainer.addEventListener('click', (evt) => {
const picture = evt.target.closest('.picture'); // Клик на элменте у которого у самого или у родителя есть .picture.
// Делегируем потому что количество картинок может меняться + создавать обработчик на каждую картику не целесообразно.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

С изменением кол-ва картинок мы справимся, так как повесим на каждую из них свой в результате обхода всех в цикле, а вот кол-во обработчиков у нас сильно возрастёт, что будет большой проблемой.

Comment thread js/utils.js
@keksobot keksobot merged commit 23cf5ad into htmlacademy-javascript:master Apr 5, 2026
1 check passed
@Kate1jkee Kate1jkee deleted the module8-task1 branch April 11, 2026 15:55
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.

3 participants