JavaScript Switch
699 ワード
var day=new Date().getDay();
switch (day){
case 0:
x="Today is Sunday";
break;
case 1:
x="Today is Monday";
break;
case 2:
x="Today is Tuesday";
break;
case 3:
x="Today is Wednesday";
break;
case 4:
x="Today is Thursday";
break;
case 5:
x="Today is Friday";
break;
case 6:
x="Today is Saturday";
break;
}
console.log(x)
var y="y"
switch(y){
case "xx":
console.log("foo")
break
case "yy":
console.log("bar")
break;
default:
console.log("tx")
break
}