Created
October 31, 2013 17:03
-
-
Save mrobinson537/7253271 to your computer and use it in GitHub Desktop.
Display days of the week using Array's and For loops in Javascript...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var days = new Array(); | |
days[0] = "Sun"; | |
days[1] = "Mon"; | |
days[2] = "Tues"; | |
days[3] = "Wed"; | |
days[4] = "Thur"; | |
days[5] = "Fri"; | |
days[6] = "Sat"; | |
// Second way you could do this | |
var days2 = new Array("Sun","Mon","Tues","Wed","thurs","Fri","Sat"); | |
alert(days.length); | |
for (i=0;i<days.length;i++) | |
{ | |
//document.write("Day" + i + "=" + days[i] + "</br>") | |
document.write("<h1>" + days[i] + "</h1>"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment