Have been trying to solve this problem and there’s no way I can solve it:
Help Elliott and the fSociety crew with a little pet project. Security is paramount to this group of anarchist rebels. And someone has to make sure that their hideout is not compromised.
The password to enter the Arcade has to be kept secure, and it changes every day. The first seven characters change every week, while the last ones are updated every day. The daily password is generated by appending to the weekly password the consonants of the day of the week we are in.
Your job is to create a piece of software that automatically updates the password every time a day goes by and print it.
Instructions
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…
start with:
var weeklyPass = 'darlene';
var weekDay = 'friday';
var currentPass;
This is what I have been trying to make it work but gives this error message:
var weeklyPass = 'darlene';
var weekDay = 'friday';
var currentPass;
switch (weekDay) {
case 'friday':
currentPass = weeklyPass + 'frd';
break;
case 'saturday':
currentPass = weelyPass + 'stdr';
break;
case 'sunday':
currentPass = weeklyPass + 'snd';
break;
case 'monday':
currentPass = weeklyPass + 'mnd';
break;
case 'tuesday':
currentPass = weeklyPass + 'tsd';
break;
case 'wednesday':
currentPass = weeklyPass + 'wdnsd';
break;
case 'thursday':
currentPass = weeklyPass + 'thrsd';
break;
}
console.log(currentPass);
ERROR MESSAGE: >>>>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.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
This is a pre work (between other challenges) that will allow me to have access to a programming course from academiadecodigo.org. Without it wont be allowed even to apply the course.
It is tested in their own website browser.
If I try to play with variables I get different errors.
I am always on those errors instructed to use switch on the var weekDay, and to add the different possible cases if i try just with friday.
At the end I got to this error from where I cannot figure out why the output is wrong… why password stored in currentPass is wrong… and to be sure that code works for all possible outcomes… It does already, I believe!
Thats all info I have
YESSS! You were right! That was it. Thank you so much
just didnt manage to do this right (your text below) but next time will make it ok.
“I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.”