Я дико извиняюсь, но как тут пройти проверку?
const cards = document.querySelectorAll('.card');
const field = document.querySelector('.field')
var opened = [];
var matched = 0;
var moves = 0;
cards.forEach((card) => {
card.addEventListener('click', (e) => {
card.classList.add("opened");
})
});
function shuffle (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(){
let shuffled = [];
matched = 0;
moves = 0;
//let cardsArr = [];
// for(let i=0; i<cards.length;i++){
// cardsArr.push(cards[i]);
// }
shuffled = shuffle(Array(...cards));
for(let i=0; i<shuffled.length;i++){
field.append(shuffled[i]);
}
}
init();