SyntaxError: expected expression, got '}'

Asked 1 years ago, Updated 1 years ago, 52 views

I'm learning JavaScript with Judati.

It's a question written in a while sentence.

I need to print out the following, and the code I wrote is

var num = 99;

while (num>=1) {
   console.log(num +" bottles of juice on the wall! " + num +" bottles of juice! Take one down, pass it around... "+(num -1) + " bottles of juice on the wall!");
   }
   num = num-1;
}

javascript syntax-error

2022-09-21 13:53

1 Answers

var num = 99;

while (num>=1) {
   console.log(num +" bottles of juice on the wall! " + num +" bottles of juice! Take one down, pass it around... "+(num -1) + " bottles of juice on the wall!");
   } // <-- Clear here: SyntaxError: expected expression, got '}'
   num = num-1;
}


2022-09-21 13:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.