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;
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?
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.