Help Exercise 6


#1

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') {
  console.log(currentCard);

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

#2

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

Try refreshing your browser.


#3

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


#4

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.


#5

Thanks for this helpful trick!


#6

It works for me, thanks !!!!


#7

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


#8

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


#9

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