If if | function ifIfTest(view) {
let dateLabel = "";
if (view === "Day") {
dateLabel = "MMMM D, YYYY";
}
if (view === "5 days") {
dateLabel = "MMMM D, YYYY";
}
if (view === "Week") {
dateLabel = "MMMM D, YYYY";
}
if (view === "Month") {
dateLabel = "MMMM D, YYYY";
}
if (view === "Year") {
dateLabel = "MMMM D, YYYY";
}
if (view === "Schedule") {
dateLabel = "MMMM D, YYYY";
}
return dateLabel;
}
ifIfTest("Schedule")
| ready |
Switch | function switchTest(view) {
let dateLabel = "";
switch (view) {
case "Day":
dateLabel = "MMMM D, YYYY";
break;
case "5 days":
dateLabel = "MMMM D, YYYY";
break;
case "Week":
dateLabel = "MMMM D, YYYY";
break;
case "Month":
dateLabel = "MMMM D, YYYY";
break;
case "Year":
dateLabel = "MMMM D, YYYY";
break;
case "Schedule":
dateLabel = "MMMM D, YYYY";
break;
}
return dateLabel;
}
switchTest("Schedule")
| ready |
If else if | function ifElseIfTest(view) {
let dateLabel = "";
if (view === "Day") {
dateLabel = "MMMM D, YYYY";
} else if (view === "5 days") {
dateLabel = "MMMM D, YYYY";
} else if (view === "Week") {
dateLabel = "MMMM D, YYYY";
} else if (view === "Month") {
dateLabel = "MMMM D, YYYY";
} else if (view === "Year") {
dateLabel = "MMMM D, YYYY";
} else if (view === "Schedule") {
dateLabel = "MMMM D, YYYY";
}
return dateLabel;
}
ifElseIfTest("Schedule")
| ready |
If else if else | function ifElseIfElseTest(view) {
let dateLabel = "";
if (view === "Day") {
dateLabel = "MMMM D, YYYY";
} else if (view === "5 days") {
dateLabel = "MMMM D, YYYY";
} else if (view === "Week") {
dateLabel = "MMMM D, YYYY";
} else if (view === "Month") {
dateLabel = "MMMM D, YYYY";
} else if (view === "Year") {
dateLabel = "MMMM D, YYYY";
} else {
dateLabel = "MMMM D, YYYY";
}
return dateLabel;
}
ifElseIfElseTest("Schedule")
| ready |