×

javascript · level 1 · unit 2 · lesson 4

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

lets your program ask a question.

prompt is like a waiter taking your order. It asks a question, waits while the person types an answer, then hands back what they typed as a string.

Store the answer in a variable so you can use it. let snack = prompt("Favourite snack?"); puts whatever they type into the box called snack.

prompt does not add anything to the output. Only console.log does that, so show the answer with console.log when you want to see it.

The answer is always a string, even when someone types a number.