I’m trying to shuffle some cards from my memory game and I can’t figure out why the shuffleCards function won’t work:
const cards = document.querySelectorAll('.card');
function shuffleCards() {
cards.forEach(card => {
let randomPos = Math.floor(Math.random() * 12);
card.style.order = randomPos;
});
};