Challenge Hints: While Loops

A list of hints for the challenges in the While Loops lesson.

Last updated - July 10, 2023

 

Checkpoint

Did you include an alert statement at the beginning?

Did you set your variable named workout equal to true (lowercase)?

Did you remember to use two equals signs == when checking the condition of your while loop?

Did you put the variable named response INSIDE the while loop?

Did you include an alert that runs IF the variable named response is equal to "y"?

Did you reassign the variable named workout to the value of false?

Did you include an alert statement inside the ELSE statement?

Test Time

Did you declare a variable initially as true?

While the variable is still true, did you ask the user if they have answered every question?

If they had answered every question, did you ask them if they are done with the test?

Did you set the still taking test variable to false if they answered that they are completed with the test?

Otherwise, did you alert them to check their answers?

Otherwise, since they had not answered each question, did you alert them to answer each question?

Once they are completed, did you alert them to turn in their test?

Index Cards

Did you declare an array with at least 10 terms that you would like to study?

Did you create a while loop that has a for  loop to iterate through the entire array each time?

Did you make sure and check to see if the user is done studying?

Once they are complete with their studying, did you alert a message wishing them luck?

Track Times

Did you initialize the variable of the count of laps to 0?

Did you declare a while loop asking if the user would like to run another lap?

If the user wanted to run another lap, then increment the number of laps

Otherwise, did you alert them that their workout is completed?

Once their workout is complete, did you alert them the total number of laps that they had run?

Homework Automator

Did you initialize a variable as false?

While the user has not completed their homework, did you get if they have any assignments remaining?

If they do have remaining assignments, did you ask them what they still need to do?

Otherwise, did you end alert them they are done with their homework and end the while loop?

Fast Food

Did you declare an empty array?

Did you declare a variable using a boolean in order to keep track if the user wants to keep ordering food?

While the user is not done with the order, get the next item for the order and push it to the array

Did you make sure to check if they want to order anything else?

After the order is complete, did you log it to the console in one statement?

 

For more help with JavaScript, check out our JavaScript Reference Guide!