USE PROMPTS FOR NUMERIC INPUT
You can also use a prompt to obtain numbers from the user and then use those numbers to do a calculation. Remember -- a prompt returns a string value. If you want to add the numbers together, you need to convert them from strings to numeric data using the techniques discussed in Lesson 2.
For example, if you want to display a user's age, you would do the following:
var tyear = prompt
("Please enter the four digit number for the
current year: ", "");
var byear = prompt
("Please enter the four digit number for the
year you were born: ", "");
var age = tyear - byear;
alert ("You were born in " + byear+'\n'+
"You will be " + age +
" on your birthday this year.");
