Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

switch


        var a = prompt("value 1")
        var b = prompt("value 2")
        var c = prompt("value 3")
        var d = prompt("value 4")
        var e = prompt("value 5")

        switch (true) {
            case (a >= b && a >= c && a >= d && a >= e):
                console.log(a + " this is greater value");
                break;
            case (b >= a && b >= c && b >= d && b >= e):
                console.log(b + " this is greater value");
                break;
            case (c >= a && c >= b && c >= d && c >= e):
                console.log(c + " this is greater value");
                break;
                case  (d >= a && d >= b && d >= c && d >= e):
                    console.log(d + " this is greater value");
                    break;
                    case (e >= a && e >= b && e >= c && e >= d):
                        console.log(e + " this is greater value");
                        break;
                      

        }
 
PREVIOUS NEXT
Tagged: #switch
ADD COMMENT
Topic
Name
3+5 =