кучу всего перепробовал. по задумке скрипт создает 5 карточек при старте страницы
const initialCards = [
{
name: 'Архыз',
link: 'https://pictures.s3.yandex.net/frontend-developer/cards-compressed/arkhyz.jpg'
},
{
name: 'Челябинская область',
link: 'https://pictures.s3.yandex.net/frontend-developer/cards-compressed/chelyabinsk-oblast.jpg'
},
{
name: 'Иваново',
link: 'https://pictures.s3.yandex.net/frontend-developer/cards-compressed/ivanovo.jpg'
},
{
name: 'Камчатка',
link: 'https://pictures.s3.yandex.net/frontend-developer/cards-compressed/kamchatka.jpg'
},
{
name: 'Холмогорский район',
link: 'https://pictures.s3.yandex.net/frontend-developer/cards-compressed/kholmogorsky-rayon.jpg'
},
{
name: 'Байкал',
link: 'https://pictures.s3.yandex.net/frontend-developer/cards-compressed/baikal.jpg'
}
];
for (i = 0; i < initialCards.length; i = i + 1){
let element = blockTemplate.querySelector('.element').cloneNode(true);
let element__img = document.querySelector('.element__image');
element__img.src = initialCards[i].link;
element.querySelector('.element__text').textContent = initialCards[i].name;
console.log(i)
}
ошибка:Uncaught TypeError: Cannot set properties of null (setting 'src')
at cards.js:33:22