JSFiddle - React, Tailwind, and code Playground

by notme

JavaScript

function testSwitch(){
    switch(rand()){
        case 1: console.log("1"); 
            break;
        case 2: console.log("2"); 
            break;
        case 3: console.log("3"); 
            break;
        default: console.log("default");
    }
}

function rand(){
    return (Math.ceil((Math.random()*10)/2));
}

testSwitch();