const cards = document.querySelectorAll('.card');
const field = document.querySelector('.field')
let opened = [];
let matched = 0;
let moves = 0;
let arr = [];
let shuffled = [];
cards.forEach((card) => {
card.addEventListener('click', (e) => {
card.classList.add('opened');
addMove();
})
});
function shuffle (_arr){
var 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');
moves = 0;
matched = 0;
shuffled = shuffle([...cards]);
for(let i=0; i<shuffled.length;i++){
field.append(shuffled[i]);
}
}
function addMove () {
moves++;
console.log(moves);
document.querySelector('span').innerText = moves;
}
init();
условия задачи выполнены, но проверку пройти не могу