View Single Post
  #1 (permalink)  
Old January 7th, 2016, 08:02 AM
Wilfred Desert Wilfred Desert is offline
Registered User
Points: 26, Level: 1
Points: 26, Level: 1 Points: 26, Level: 1 Points: 26, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2016
Posts: 8
Thanks: 2
Thanked 1 Time in 1 Post
Default Ch3. The do..while loop. (no semicolon);

On page 82 there's a do-while loop example.

Quote:
var userAge;
do {
userAge = prompt("Please enter your age","")
} while (isNaN(userAge) == true);
and below the author repeats one more time:

Quote:
userAge = prompt ("Please enter your age","")
There's no semicolon at the end of the statement inside the do {} block. As far as I can remember the author stated that it's considered best to always end any statement with a semicolon although it's not a must in most cases.

Was the omission of ; intentional? It seems so considering that in both the 4th and 5th editions there's no semicolon.
And there's also a repetition of that line below which doesn't contain a semicolon either.
Of course, you might say that it's not even a mistake. I just want to understand whether or not a semicolon was meant. If not - then it's a minor sign of incosistency.
Reply With Quote