Bom dia galera, tudo bem?
Por acaso poderiam me ajudar com um erro que estou tendo com o appendChild?
Estou desenvolvendo um jogo da memória com HTML, CSS e JS. Já fiz todo o html, css, e lógica do game no JS, porém quando coloco o appendChild para puxar minha div, ele erro, vou colocar o código abaixo:
startGame();
function startGame() {
cards = createCardsFromTechs(techs);
shuffleCards(cards);
initializeCards(cards);
}
function initializeCards(cards) {
let gameBoard = document.getElementById("gameBoard");
cards.forEach(card => {
let cardElement = document.createElement('div');
cardElement.id = card.id;
cardElement.classList.add(CARD);
cardElement.dataset.icon = card.icon;
createCardContent(card, cardElement);
cardElement.addEventListener('click', flipCard);
console.log(cardElement);
// <UM TESTE PARA VER SE ESTA PUXANDO AS CARTAS>
//gameBoard.appendChild(cardElement); <ERRO ESTA AQUI>
})
}