This article has shared 4 kinds of JS computing system The current date is the day of the week, for your reference, the specific content as follows
Method One:
The computing system is currently the week several
var str = "Today is the Week" + "Day 123456". Charat (new Date (). Getday ());
Method Two:
var a = new Array ("Day", "one", "two", "three", "four", "five", "six");
var week = new Date (). Getday ();
var str = "Today is Week" + A[week];
alert (str);
Method Three:
var str = "Today is Week";
var week = new Date (). Getday ();
Switch (week) {case
0:
str1 + = "Day";
break;
Case 1:
str1 = "one";
break;
Case 2:
str1 + = "two";
break;
Case 3:
str1 + = "three";
break;
Case 4:
str1 + = "four";
break;
Case 5:
str1 = "Five";
break;
Case 6:
str1 = "Six";
break;
alert (str);
Method Four:
var str = "";
var week = new Date (). 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);
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.