No output in While loops exercise


I have completed the exercise, but there is no output showing every time I run the code - just a blank black screen. Hard to fully understand this exercise without seeing the code output from the while loop.

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

while (currentCard !== 'Spade') {
  var randomNumber = math.Random() * 4;
  currentCard = cards[randomNumber];

console.log('The result is: Spade');


The random() method is written in lowercase. The special class Math is written with a capital M.


To generate an integer index number, in the range 0 to 3, we pass the above into the Math.floor() method and multiply by 4. Be sure the 4 is inside the parentheses.

Math.floor(Math.random() * 4)



Thanks a lot!


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