[NOT DONE!] Switch Error! 4/6


#1

Ive Had A Bad Couple Of Tries On This Question And One Of Them Was Clicking The Reset Button So Im Back At Square One Were I Know Nothing Of This Switch.

var user = prompt("Question to the user").toUpperCase();

switch( user ) {
  case "bill":
       //do somethong
       break;
   //
   //
   default:
       //do something
  }

So Can Someone Just Send Me A Code, Please?


#2

@blogrockstar04670,

In
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
[quote]

switch (parameter-expression) {
  case value1:
    //Statements executed 
    //      when the VALUE of expression matches value1
    [break;]
  case value2:
     //Statements executed 
    //      when the VALUE of expression matches value2
    [break;]
 ...
  case valueN:
    //Statements executed 
    //      when the VALUE of expression matches valueN
    [break;]
  default:
    //Statements executed 
    //      when none of the VALUE's match the VALUE of the expression
    [break;]
}

= = = = = = = = = = = = = = = = = = = = = = = = = = = =

The switch statement evaluates an parameter-expression,
matching the parameter-expression's VALUE to a case clause,
and executes statements associated with that case.
( and with the break or return-statement will exit the switch statement )
[end-quote]

= = = = = = = = = = = = = = = = = = = = = = = = = = = =

In your case clause you are using an expression
An expression is any valid unit of code that resolves to a VALUE.

Conceptually, there are two types of expressions:
-1 those that assign a value to a variable
and
2- those that simply resolve to a VALUE.

So in your case clause you are using the 1nd kind of expression
and you do that by
using string VALUE

Thus your case clause VALUE
is matched against the VALUE of the parameter-expression

switch( user ) {
  case "bill":
       //do somethong
       break;
   //
   //
   default:
       //do something
  }