Skip to content

Day name

JavaScript switch + default

Flowchart (ISO 5807)

YesNoYesNoStartInput dd = 1Return «Пн»Endd = 2Return «Вт»EndReturn «?»EndFigure 1 — dayName

Source code

JavaScript
function dayName(d) {
    switch (d) {
        case 1: return "Пн";
        case 2: return "Вт";
        default: return "?";
    }
}

The editor opens with this code — change it and the chart redraws.

Language
JavaScript
Constructs
switch + default
Topic
Switch / case
Formats
Word, Visio, draw.io, PDF, SVG

Related examples