Method One:
// The calculation system is currently the day of the week var str = "Today is the Week" + "Day 123456". Charat (new date (). Getday ());
Method Two:
var new Array ("Day", "one", "two", "three", "four", "five", "six"); var New date (). Getday (); var str = "Today is the Week" + A[week];alert (str);
Method Three:
varstr = "Today is the Week";varWeek =Newdate (). Getday ();Switch(week) { Case0: str1+ = "Day"; Break; Case1: str1+ = "One"; Break; Case2: str1+ = "Two"; Break; Case3: str1+ = "three"; Break; Case4: str1+ = "Four"; Break; Case5: str1+ = "Five"; Break; Case6: str1+ = "Six"; Break;} alert (str);
Method Four:
varstr = "";varWeek =Newdate (). Getday ();if(Week = = 0) {str= "Today is Sunday";} Else if(Week = = 1) {str= "Today is Monday";} Else if(Week = = 2) {str= "Today is Tuesday";} Else if(Week = = 3) {str= "Today is Wednesday";} Else if(Week = = 4) {str= "Today is Thursday";} Else if(Week = = 5) {str= "Today is Friday";} Else if(Week = = 6) {str= "Today is Saturday";} alert (str);
Of course, the perfection of these four methods is at a glance.
JS Computing System The current date is the day of the week several ways