Hello i am stuck with this assessment , can you read the instructions and tell me what should be my code ? Create a while loop with a condition that checks if the currentCard does not have that value 'spade'

Loops | Codecademy

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