Can someone help me with this?
Maybe it's a stupid question but I cant figure it out. I try to make a simple card game, and after the shuffle the player should get a random card. I created this to select a random card out of the deck, but it only shows cards wich are spades. It's probably a small error but I don't see it.
playerCardOne.onclick = () => { let color = Math.floor(Math.random() * 4); let card = Math.floor(Math.random() * 13); switch (color) { case 0: switch (card) { case 0: playerCardOne.src = club1; break; case 1: playerCardOne.src = club2; break; case 2: playerCardOne.src = club3; break; case 3: playerCardOne.src = club4; break; case 4: playerCardOne.src = club5; break; case 5: playerCardOne.src = club6; break; case 6: playerCardOne.src = club7; break; case 7: playerCardOne.src = club8; break; case 8: playerCardOne.src = club9; break; case 9: playerCardOne.src = club10; break; case 10: playerCardOne.src = club11; break; case 11: playerCardOne.src = club12; break; case 12: playerCardOne.src = club13; break; default: break; } case 1: switch (card) { case 0: playerCardOne.src = heart1; break; case 1: playerCardOne.src = heart2; break; case 2: playerCardOne.src = heart3; break; case 3: playerCardOne.src = heart4; break; case 4: playerCardOne.src = heart5; break; case 5: playerCardOne.src = heart6; break; case 6: playerCardOne.src = heart7; break; case 7: playerCardOne.src = heart8; break; case 8: playerCardOne.src = heart9; break; case 9: playerCardOne.src = heart10; break; case 10: playerCardOne.src = heart11; break; case 11: playerCardOne.src = heart12; break; case 12: playerCardOne.src = heart13; break; default: break; } case 2: switch (card) { case 0: playerCardOne.src = diamond1; break; case 1: playerCardOne.src = diamond2; break; case 2: playerCardOne.src = diamond3; break; case 3: playerCardOne.src = diamond4; break; case 4: playerCardOne.src = diamond5; break; case 5: playerCardOne.src = diamond6; break; case 6: playerCardOne.src = diamond7; break; case 7: playerCardOne.src = diamond8; break; case 8: playerCardOne.src = diamond9; break; case 9: playerCardOne.src = diamond10; break; case 10: playerCardOne.src = diamond11; break; case 11: playerCardOne.src = diamond12; break; case 12: playerCardOne.src = diamond13; break; default: break; } case 3: switch (card) { case 0: playerCardOne.src = spade1; break; case 1: playerCardOne.src = spade2; break; case 2: playerCardOne.src = spade3; break; case 3: playerCardOne.src = spade4; break; case 4: playerCardOne.src = spade5; break; case 5: playerCardOne.src = spade6; break; case 6: playerCardOne.src = spade7; break; case 7: playerCardOne.src = spade8; break; case 8: playerCardOne.src = spade9; break; case 9: playerCardOne.src = spade10; break; case 10: playerCardOne.src = spade11; break; case 11: playerCardOne.src = spade12; break; case 12: playerCardOne.src = spade13; break; default: break; } default: break; } }