Your job is to build a trip-planner website using both the alert
and prompt
functions in JavaScript. You will be coding your solution in js/planner.js
. You'll want to have index.html
open in the browser to test your work.
You'll be using the prompt
function to take in input from your user, and alert
to relay information back to the user.
You can store the input from the user by using a variable:
var name = prompt('Please enter your name:');
In the example above, we've declared the variable name
and set it equal to prompt('Please enter your name:')
. In this line of code, the name
variable will store whatever name the user enters in the text box that appears in the browser.
Now that we have the data from the user stored in the variable name
, we can use that variable in our code to manipulate the data.
- Step 1: Your job is to take in the follow information from the user:
name
age
trip_destination
number_of_travelers
type_of_trip (relaxing, adventure, etc)
-
Step 2: Once you have all the information you need, your job is to print out a sentence describing the user's vacation wishes and a promise to find them the best possible trip.
-
BONUS: Once the user enters what find of trip they want, see if you can figure out how to make suggestions based on what type of trip (ie: suggest a beach vacation for a relaxing trip, or hiking Machu Pichu for an adventure trip).
View JavaScript Trip Planner on Learn.co and start learning to code for free.