I´m stuck on this exercise, I cant see what i did wrong the exercise asks: Having got the value of the weekly password stored in weeklyPass, update and print t

Having got the value of the weekly password stored in weeklyPass, update and print to the console the value of currentPass depending on the day of the week we are in. To know which day of the week it is simply access weekDay.

Remember that updating the password is appending the letters corresponding to the consonants present in the name of the current day of the week.

There are many ways of cracking this problem, but Elliot and the guys specifically asked for you to use a switch statement…
var weeklyPass = ‘darlene’;
var weekDay = ‘friday’;
var currentPass;

switch(weekDay) {
case “monday”:
currentPass = weeklyPass + “mnd”;
break;

case "tuesday":
    currentPass = weeklyPass + "tsd";
    break;
    
case "wednesday":
    currentPass = weeklyPass + "wdnsd";
   break;
    
case "thursday":
    currentPass = weeklyPass + "thrds";
    break;
    
case "friday":
    currentPass = weeklyPass + "frd";
    break;
    
case "saturday":
    currentPass = weeklyPass + "strd";
    break;
    
case "sunday":
    currenPass = weeklyPass + "snd";
    break;

}

    console.log(currentPass);

What is the error you’re getting? What do you want your code to do? What is happening instead?

Output

Code is incorrect

Your code is producing the wrong output. The password stored in currentPass is incorrect! Be sure your code works for all possible outcomes.

darlenefrd

You should log all possible outcomes (changing the value of weekDay)… That should be the first step of debugging. Is there something odd when you do that?

I see a typo here.

nothing odd when i change the weekay, it was not just the typo, but thanks i didnt notice it

Does your code work now?

no; the password chanhe when i change the week day, but the exercise is still wrong: Output

Code is incorrect
Your code is producing the wrong output. The password stored in currentPass is incorrect! Be sure your code works for all possible outcomes.

It might have something to do with the password you’re producing whenever you’re assigning a new value to currentPass.

Your consonant string for the “thursday” case doesn’t look quite right to me.

Check it very carefully.

1 Like