Objective:
Work with numeric input and simple arithmetic to convert years to days.
Instructions:
Write a JavaScript program that starts by asking the user for their age in years. (Use the prompt() function to collect this information, and be sure to give the user appropriate instructions!)
Calculate the user's age in days by multiplying their age in years by 365. (Don't worry about leap years.)
Use console.log() to display a message to the user that tells them how many days old they are. The message should be in the format: "You are approximately [number of days] days old."
Example Output: If the user enters "25" as their age, the output should be "You are approximately 9125 days old."
Note: Don't try to include the days that have passed since the user's last birthday. That would require branching logic, which we'll look at in Module 2.
Objective: Work with numeric input and simple arithmetic to convert years to days.
Instructions:
Example Output: If the user enters "25" as their age, the output should be "You are approximately 9125 days old."
Note: Don't try to include the days that have passed since the user's last birthday. That would require branching logic, which we'll look at in Module 2.