Search⌘ K
AI Features

User Interactions

Explore how to interact with users in JavaScript by collecting inputs through prompt dialogs and displaying messages using alert and console.log. Understand how to convert string inputs into numbers for calculations and improve your ability to handle user-driven events in your programs.

Entering information

Once you start using variables, you can write programs that exchange information with the user.

During execution, a dialog box pops up, asking for your name.

This is the result of the JavaScript command prompt("Enter your first name:").

Type your name and click OK. You’ll then get a personalized ... ...