152k views
1 vote
Fill in the missing statements or expressions in the following code that checks to ensure that a user enters an integer value at the prompt: var purchase = parseInt(prompt("How many do you want?"," ")); var check = __________; while (__________) { purchase = parseInt(prompt("Enter a whole number:", " ")); ___________________; }

User Sacky San
by
8.3k points

1 Answer

3 votes

Answer:

The correct fill in the blanks in the given question is given as

var check = num.isInteger(purchase); // giving the input by the user--(1)

while(!check) // check the condition .......(2)

{

check = num.isInteger(purchase); // taking by the user in the "num" ..(3)

}

Step-by-step explanation:

Following are the description of solution

  • In the first statement, we Taking the input in the "check" variable. This statement num.isInteger(purchase); is taking the input and convert this into an "integer" type.
  • The while(!check) is checking and controlling the condition of a while loop.
  • Finally, we taking the input inside the while loop to regulate the condition of while loop.
User Portman
by
8.2k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.