Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUICK JAVASCRIPT QUESTION. Hello, I am making a program ins Java script that subtracts a date from the current date and outputs how many days

QUICK JAVASCRIPT QUESTION.

Hello, I am making a program ins Java script that subtracts a date from the current date and outputs how many days you have lived, but it is not printing out in my HTML page.

here is the code:

HTML CODE:

Date and Time Methods

Todays Date and Time Is:

The Birthdate You Entered Is:

You Have Lived For:

JAVASCRIPT CODE:

 function start() { n = new Date(); y = n.getFullYear(); m = n.getMonth() + 1; d = n.getDate(); document.getElementById("currentDate").innerHTML = m + "/" + d + "/" + y; return[y, m, d] } function middle() { b = new Date(); mString = window.prompt("Enter Month You Were Born (1-12): "); dString = window.prompt("Enter Day You Were Born (1-31): "); yString = window.prompt("Enter The FULL Year You Were Born: "); m = parseInt(mString); d = parseInt(dString); y = parseInt(yString); document.getElementById("birthdate").innerHTML = m + "/" + d + "/" + y; return [y, m, d] } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions