prompts Flashcards
What is the keyword that displays a box requesting user input?
prompt
What is the keyword in a statement that shares most of the syntax of a prompt statement?
alert
What do you need in order to capture a user’s input in a prompt box? Answer with one word.
variable
var gender = prompt(askGender, bestGuess); In the above statement, what is optional?
bestGuess
Code a prompt with the message “Enter first name”. The user’s response is assigned to firstName, which hasn’t been declared beforehand.
var firstName = prompt(“Enter first name”);
Code a prompt with the message “Country?” and the default answer “China”. The user’s response is assigned to country, which hasn’t been declared beforehand.
var country = prompt(“Country?”, “China”);
Code a prompt that specifies a string as the message. Assign the user’s response to a variable that hasn’t been declared beforehand.
var parrotName = prompt(“Enter name of parrot”)
Code a prompt that specifies a string as the message. Include a default input. Assign the user’s response to a variable that hasn’t been declared beforehand.
var name = prompt(“Enter parrot name”, “Polly”);
Code a prompt that specifies a variable as the message and assigns the user’s response to a variable that hasn’t been declared beforehand.
var response = prompt(question);
Code a prompt that specifies a variable as the message, a second variable as the default response, and assigns the user’s response to a third variable that hasn’t been declared beforehand.
var response = prompt(question, defAnsw);
Assign strings to two variables. Code a prompt specifying the first variable as the message and the second variable as the default response. Assign the user’s response to a third variable. None of the variables have been declared beforehand.
var question = "Name of parrot?"; var defaultAnswer = "Polly"; var pName = prompt(question, defaultAnswer);
var sex = prompt(askGender, bestGuess); Re-code the statement above, omitting what's optional.
var sex = prompt(askGender);