While Loops


Someone could explain to me why is not working (3rd part)?


let cards = [‘Diamond’, ‘Spade’, ‘Heart’, ‘Club’];
let currentCard = ‘Spade’;
while (currentCard !== ‘Spade’) {console.log(currentCard);
let randomNumber = Math.floor(Math.random() * 4); currentCard = cards [randomNumber];}


SyntaxError: Unexpected character ‘‘’ (1:13)

Replaced the ‘ with ', and…

SyntaxError: Unterminated string constant (1:13)

Replace the ’ with ', and…

SyntaxError: Unexpected character ‘‘’ (1:24)

If you composed this code yourself, then you simply used the wrong quote characters. You’ll need to fix the above code to use either ' or " as quotes.


I am sorry but I do not understand what you mean?


What do you not understand? Did you copy the code that you pasted in to your question? If so, that would explain the non-standard punctuation.

Usually the single quote, ' and double quote, " are found on the same key, the latter being shifted.

The left-single-quote and right-single-quote are non-standard and not recognized by code parsers.


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