Search⌘ K
AI Features

React to the User

Explore how to interact with users using JavaScript by capturing input through prompt(), creating personalized messages with string concatenation, and displaying responses both in alerts and on the web page. This lesson teaches you to make your web pages feel more engaging and dynamic through user interaction.

Let’s make JavaScript feel like a real conversation. In this lesson, you’ll ask the user something using prompt(), and use what they say to update your page or show a message.

Goal

You will learn to:

  • Get user input with prompt().

  • Display the input in an alert or on the page. ...