String Week Challenge - Day 7

String Week Challenge - Day 7

It all becomes clear

·

3 min read

Hey! Here we are, a whole 7 days into this adventure. Thanks for joining in, it's really cool that other people want to play secret spy message decoder with me!

⏰ Complete this week's Challenges

Welcome to String Week! We're working towards decoding a secret message by combining all our work for the week, please check out Days 1-5 before working on today's challenge.

⭐ String Week

This week our challenges all deal with Strings! As one of JavaScript's primitive data structures, Strings are critical to understand and manipulate. Feel free to use JavaScript's built-in String methods.

🏆 The Challenge - Day 7

Oooh, yeah! Here it is, the final function you'll need in your string-decoding arsenal this week. Today's challenge might not be too trying after all the others, but you never know!

Today you'll need to create a function that swaps each letter of the alphabet for its opposite. A letter's opposite is one that, if the alphabet were flipped Z-A, would be the same number of letters in, and which would also have the opposite case.

Examples:

'A'  // first letter of the alphabet, uppercase
'z'  // last letter of the alphabet, lowercase

'p'  // 16th letter of the alphabet, lowercase
'K'  // 16th letter from *end* of alphabet, uppercase

'vCZNKOV: 0 MFNYVI LI KFMXGFZGRLM XSZMTVH'
// function replaces letters with opposites
'Example: 0 number or punctuation changes'

Do me a favor and try to solve it a couple of different ways to see which you preferred and why.

🧩 Put it all Together

Finally! We have every function needed to decode the gobbledygook I shared a week ago! Some of you already figured it out yesterday (bravo!), but let's pretend you didn't.

Please use the daily functions, in order, to decode the week's secret message. Then, when you feel good about your result, go ahead and tweet the string with no explanation and #huntober2022, you earned it.

const encryptedMsg = "e!!Igv)t5lltBcvbdeDH3dVw!OOtI#Aa.ZMDu7WYpP^VVjDc4I50iv#ylhgmQfs"

Two things to note:

  1. It's very important that the functions are called in the order they were given (e.g. Day 1 first, Day 7 last), as any deviation could throw things far out of whack
  2. Day 2 and Day 5 weren't designed to be part of this overall decoder. The answers you got on those days should be used as inputs for Days 3 & 6 respectively

👏 What now?

Please feel free to share your answers at each step, your code, feelings about the challenges, etc. as you please! I only ask that any spoilers have a little warning in case anyone wants to come in fresh later.

I'm torn on if I should share my code or not, as I went mostly brute force with this and the code is that of the baddie that I am. Let me know in the comments what you think I should do.

If you really want to go wild, see if you can reverse engineer an encoding sequence. A solution that fits any given string, key characters, and decoy sequence might not be as easy as it appears...

Come back tomorrow for Week 2 - Day 1!

It's gonna be fun 🤓


Wait, What's Huntober?

Leon Noel's 100Devs are spending October preparing for the job hunt. Anyone who has already broken into a tech career knows that the application and interview process can be grueling! The current cohort has progressed this year all the way from basic HTML files to hosted full-stack applications with authentication and databases.

This month they'll continue to build, but will also work on data structures & algorithms, networking and interview skills, and solving code challenges.