Please Heeeeelp... ( WHILE LOOP)

Your editor currently has a variable declared target to which a random number between 0 and 10 will be assigned. Print the target to the console.

Write a small program which will keep guessing numbers between 0 and 10 and printing them until the guessed number is the same as the target.

MY CODE:

var target = Math.floor(Math.random() * 11);
var guess = Math.floor(Math.random() * 11);

console.log(target);

while ( guess !== target);{
    console.log("try again");
    guess = Math.floor(Math.random() * 11);
}
 
     console.log("congrats");

Output

Code is incorrect

unknown error

Should there be a semi-colon in this while statement?

No semi colon should appear in the first line of the while condition, and your quotes in the console log seem to be “formatted”. Try to re-type them, or comment out that line and see if your code works.

They appear like that because the OP didn’t quite paste their code in here correctly.

To display your code in here you need to wrap it in triple back ticks. On a line by itself type three back ticks. Then on the first line below the three back ticks paste in your code. Then below your code on a new line type three more back ticks. The back tick on my keyboard is in the upper left just above the Tab key and below the Esc key.

If they would have done that then the quotes would appear as regular ascii quotes.