1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
What is the keyword that displays a box requesting user input? | prompt | prompt | |
In the following code, what is the variable that's optional? | let gender = prompt(askGender, bestGuess); | bestGuess | bestGuess |
Code a prompt that says "Enter first name". The user's response is assigned to firstName, which hasn't been declared beforehand. | let firstName = prompt("Enter first name"); | letfirstName=prompt\(•Enterfirstname•\); | |
Code a prompt that asks "Favorite food?" Include a default response, "pizza". The user's response is assigned to favFood, which hasn't been declared beforehand. | let favFood = prompt("Favorite food?", "pizza"); | letfavFood=prompt\(•Favoritefood\?•,•pizza•\); | |
Code a prompt. Assign the user's response to a variable that hasn't been declared beforehand. Make up everything. | let nationality = prompt("Enter nationality"); | let[a-z_$][a-zA-Z0-9_$]*=prompt\(•.*•\); | |
Code a prompt. Include a default response. Assign the user's response to a variable that hasn't been declared beforehand. Make up everything. | let name = prompt("Enter parrot name", "Polly"); | let[a-z_$][a-zA-Z0-9_$]*=prompt\(•.*•,•.*•\); | |
Code a prompt using a variable rather than a string to specify the information you're asking the user to enter. Assign the user's response to a variable that hasn't been declared beforehand. Make up everything. | let response = prompt(question); | let[a-z_$][a-zA-Z0-9_$]*=prompt\([a-z_$][a-zA-Z0-9_$]*\); | |
Assign strings to two variables. Code a prompt specifying the first variable as the question and the second variable as the default answer. Assign the user's response to a third variable. None of the variables have been declared beforehand. Make up everything. | let question = "Name of parrot?"; let defaultAnswer = "Polly"; let pName = prompt(question, defaultAnswer); |
let([a-z_$][a-zA-Z0-9_$]*)=•.*•;[\r\n]let([a-z_$][a-zA-Z0-9_$]*)=•.*•;[\r\n]let[a-z_$][a-zA-Z0-9_$]*=prompt\(\1,\2\); | |
|
|||
|