Right now, my code is something like this:
var day = getDay(); //A function that gets this current day of the week as integer
var dayname = "";
if (day==0) dayname = "Su";
if (day==1) dayname = "Mo";
...
if(day==6) dayname = "Sa";
It works, but I feel like it could be way shorter, something like this:
if (day == (0,1,2,3,4,5,6)) dayname = ("Su","Mo",...,"Sa");
Is there a way to do that?
Aucun commentaire:
Enregistrer un commentaire