Basic Input Concepts with prompt() in JavaScript
📖 Scenario: You are creating a simple webpage that asks the user for their favorite fruit and then shows a message with their answer.
🎯 Goal: Build a small program that uses prompt() to get user input and then displays it using alert().
📋 What You'll Learn
Use
prompt() to ask the user for their favorite fruitStore the input in a variable called
favoriteFruitCreate a message string that says "Your favorite fruit is: " followed by the input
Use
alert() to show the message💡 Why This Matters
🌍 Real World
Getting input from users is common in web pages for surveys, forms, or interactive tools.
💼 Career
Understanding how to collect and use user input is a basic skill for web developers and software engineers.
Progress0 / 4 steps