Не пропускает, при этом количество шагов в .moves-counter span не меняется...
const movesCount = document.querySelector('.moves-counter span');
const modal = document.querySelector('.congratulation-message span')
const tryAgainButton = document.querySelector('#try-again');
console.log(modal);
var opened = []
var matched = 0
var moves = 0
function shuffle (_arr) {
const arr = [..._arr];
for (let i = arr.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
return arr;
}
function init() {
const cards = document.querySelectorAll('.card');
const field = document.querySelector('.field');
var shuffled = []
matched = 0
moves = 0
cards.forEach((card) => {
card.addEventListener('click', (e) => {
card.classList.add('opened')
})
})
shuffled = shuffle([...cards])
for(let i = 0; i < shuffled.length; i++){
field.append(shuffled[i])
}
addMove()
modal.style.display = 'none'
}
function addMove() {
moves+ 1;
movesCount.innerHTML = `${moves}`
}
function showModal() {
modal.innerHTML = `${moves}`;
modal.style.display = 'block'
}
tryAgainButton.addEventListener('click', (e) => {
init()
})
init()