Practice 9b - COIN 70a

Do-While Loop

Assignment:


   1.Prompt the user to rate her JS teacher. Build in a little error checking. If the rating isn't great,
   prompt the user until it is and then tell them how right they are!

CODE USED:

rating = prompt("Rate your JS teacher on a scale of 1-10", "");


if ( isNaN(rating)) {
	alert("ERROR! You did not enter a number!");}
else if (rating == 10) {
alert("Great - how right you are!");}
else if (rating > 10) {
	alert("You don't follow directions very well. We need a number between 1 and 10.");}
prompt("Rate your JS teacher on a scale of 1-10.", "");
do {
rating = parseFloat(prompt("Are you sure that's all she gets?"))


} while (rating < 10);
alert("NOW you've got it right!");

BACK