Solution: It’s About Time
Review a solution for telling the user how many seconds they have been alive for.
We'll cover the following...
Solution
Here is a possible solution for telling the user how many seconds they have been alive for.
Explanation
Line 1: Displays a prompt dialog to the user, asking them to enter their date of birth in the "dd/mm/yyyy" format, which is then stored in constant variable
dob
.Line 2: Splits the user's input, which is stored in the
dob
variable, into an array using the "/" character as the delimiter.Line 3: Creates a JavaScript
Date
object using the values ...