Can someone plz help me with this activity

Can someone plz help me with this activity
0

#1

Tell us what’s happening:

Your code so far


function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  caseInSwitch (new val().getval()){
case 0;

  }
  
  // Only change code above this line  
  return answer;  
}

// Change this value to test
caseInSwitch(1);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements


#2

What kind of help do you need?


#3

You should copy the switch statement that is in the instructions. That’s not how you write a switch statement.


#4

I don’t know how to make a switch statement


#5

Instructions show the following:

switch(num) {
  case value1:
    statement1;
    break;
  case value2:
    statement2;
    break;
...
  case valueN:
    statementN;
    break;
}

#6

Did you look at the example in the challenge instructions? That is how you create a switch statement (see @zapcannon99’s post for the example code).


#8

It is pseudocode, so you will end up editing the code, but the code is the basic framework of a switch/case statement.


#9

In the instructions, they give you the following columns which represent the value the case should test (val - the 1st column) and the value that answer should be assigned (2nd column) IF val matches the case value.

1 - “alpha”
2 - “beta”
3 - “gamma”
4 - “delta”


#10

What do I replace the (num) in switch function with?


#11

The variable name which goes in between the parentheses ( ) will be the variable you want to check the value of. Which variable in the function holds the value which needs to be checked? The answer to this question is written in the instructions.

Making a slight change to the example’s pseudo-code might help you out here.

switch(variableNameToCheckValueOf) {
  case value1:
    statement1;
    break;
  case value2:
    statement2;
    break;
...
  case valueN:
    statementN;
    break;
}

#12

Thanks, it worked out.