Untitled

mail@pastecode.io avatar
unknown
plain_text
17 days ago
348 B
2
Indexable
Never
function week(num) {
    const days = [
        "Moday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday",
        "Sunday",
    ];

    if (num >= 1 && num <= 7) {
        const result = days[num - 1];
        console.log(result);
    } else {
        console.log("Invalid day!");
    }

}

week(3);
Leave a Comment