I am newbie , please help me. I have hard wired DOB as January 1, 1989, I need program to process it as parameters entered by the user.
function myFunction()
{
var person = prompt(“Please enter your name”, “”);
var day = prompt(“Enter the day of user’s date of birth” );
var month = prompt(“Enter the month of user’s date of birth” );
var year = prompt(“Enter the year of user’s date of birth”);
//test part start-1
var DOB = “January 1, 1989”;
var millisecondsBetweenDOBAnd1970=Date.parse(DOB);
var millisecondsBetweenNowAnd1970=Date.now();
var ageInMilliseconds=millisecondsBetweenNowAnd1970-millisecondsBetweenDOBAnd1970;
var milliseconds=ageInMilliseconds;
var dayy=1000*60*60*24;
var days=Math.round(milliseconds/dayy);
// test part ends
if (person != null)
{
document.getElementById(“demo”).innerHTML =
“” + person + ” ‘s birthday is “+day+” /”+month+” / “+year+” “+days+” days ago”;
}
}