dcsimg

Assignment 15: A Possible Answer

This:

<SCRIPT LANGUAGE="JavaScript">
var dayName=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthName=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var y=new Date();
document.write("Today is "+dayName[y.getDay()] + " in the month of " +monthName[y.getMonth()]+ ".");
</SCRIPT>

 

Gives you this:

     The answer was created by simply setting up another array starting with January. I set the month array to monthName, then followed the same format as was used to get the day.

 

Did You Get It?

 

Back to the Index Page