Search
 
SCRIPT & CODE EXAMPLE
 

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;
                      

        }
Comment

Switch

switch (expression) {
  case value1:
    // Statements executed when expression = value1
    break;
  case value2:
    // Statements executed when expression = value2
    break;
  case value3:
    // Statements executed when expression = value3
    break;
  default:
  // Statements executed when expression not equal to value1, value2 or value3
}
Comment

Switch

switch (expression) {
  case value1:
    // Statements executed when expression = value1
    break;
  case value2:
    // Statements executed when expression = value2
    break;
  case value3:
    // Statements executed when expression = value3
    break;
  default:
  // Statements executed when expression not equal to value1, value2 or value3
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to nested schema mongoose 
Javascript :: math.ceil node js 
Javascript :: password validation in javascript 
Javascript :: nodejs convert string to date 
Javascript :: moment format dates 
Javascript :: javascript link to page 
Javascript :: how to make a discord bot delete messages after time js 
Javascript :: loop backwards javascript 
Javascript :: how to check if input field has value 
Javascript :: flatpickr current date set to text field 
Javascript :: join text javascript 
Javascript :: shopify liquid logic 
Javascript :: express socket 
Javascript :: loop,array javascript 
Javascript :: ring add an attribute to the object 
Javascript :: javascript Symbol Properties 
Javascript :: javascript Nested Destructuring Assignment 
Javascript :: can i copy package-lock.json to another project 
Javascript :: nuxt login with google strategie 
Javascript :: nodejs: Basic: managing file: Read, Write, Create, Delete 
Javascript :: TypeError: _enzymeAdapterReact.EnzymeAdapter is not a constructor 
Javascript :: flip image on y axis phaser 
Javascript :: phaser rotate around 
Javascript :: School paperwork 
Javascript :: JAVASCRIPT CHEATSHEET 1 
Javascript :: declare 2 d vector js 
Javascript :: vue mount modal to body 
Javascript :: learn javascript 
Javascript :: select and select based on value in jquery 
Javascript :: button as a link react 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =