var cards = {
heart:[2, 3, 4, 5, 6, 7, 8, 9, 10, "joker", "queen", "king", "ace"],
spade:[2, 3, 4, 5, 6, 7, 8, 9, 10, "joker", "queen", "king", "ace"],
diamond:[2, 3, 4, 5, 6, 7, 8, 9, 10, "joker", "queen", "king", "ace"],
king:[2, 3, 4, 5, 6, 7, 8, 9, 10, "joker", "queen", "king", "ace"],
};
function cardSelectionForPlayer(){
let x = Math.floor((Math.random() * 3) + 0);
let y = Math.floor((Math.random() * Object.values(cards)[x].length-1) + 0);
if (y==9 || y==10 || y==11) {
playerHands.push(10);
} else if (y==12){
if ( ((playerHands.reduce((a,b) => a+b, 0))+11) < 21){
playerHands.push(11);
} else {
playerHands.push(1);
}
} else {
playerHands.push(Object.values(cards)[x][y]);2
}
delete Object.values(cards)[x][y];
}
I have a deck of cards and every time a player randomly selects a card, the card is removed from that deck. For example, how would I specifically remove number spade 3 from the deck?
Thanks for your time & answer.