Help Exercise 6

Help Please
Error Did you set the variable currentCard equal to ‘Heart’?

Right under the array create a variable named currentCard and set it equal to ‘Heart’.
This variable will hold the name of the card we just flipped. We are using ‘Heart’ as the first card.

var cards = ['Diamond', 'Spade', 'Heart', 'Club'];

var currentCard = 'Heart';

while (currentCard !== 'Spade') {

  var randomNumber = Math.floor(Math.random() * 4);
  currentCard = cards[randomNumber];
console.log('Found a Spade!');

It seems to be working fine. Probably just some error by Codecademy.

Try refreshing your browser.

I have the same code, works and passes for me.

At #2 instructor, you should remove loop block. There should be only first two lines.
First row: var cards = …
Second row: var currentCard = …

And run the program. The #2 must be green.
Later write loop block and run again.


Thanks for this helpful trick!

It works for me, thanks !!!

it is not working for me how is that possiple i just idont knw i am stuck

I would try a different browser and if the problem persists, contact the
admins here and they can better assist you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.