1 Like
try this
let currentCard; / /declare the variable
this while loop will loop print everything in the array except “spade”
the iterator value has been stored in the currentCard and it is being checked against the “spade”. If the value is equal to “spade” it will not print.
while(currentCard !== ‘spade’){
currentCard = cards[Math.floor(Math.random() * 4)];
console.log(currentCard)
}
1 Like
hello thanks for your response it works
1 Like