Skip to main content

Command Palette

Search for a command to run...

String Week Challenge - Day 6

Clearing the clutter away

Published
3 min read
String Week Challenge - Day 6
B

I'm a Senior UI Developer at a global tech consultancy, working on crafting custom solutions for our client companies. Clients range from nascent start-ups to Fortune 10 companies.

I also volunteer as the Community Manager for the community-based FREE online educational program at 100Devs. Its mission is to provide a completely free, accessible, welcoming path to a career as a software engineer.

Current interests include Design Systems, Component Libraries, and teaching beginners.

Hello, hello! We're almost there, almost a full week into the great month of October (aka Huntober)! Thank you so much for hanging in there and coming along on this wacky string journey with me.

⏰ Join in the Fun - It's not too Late

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 6

This week we will be discovering hidden messages by manipulating a given string. Your solutions should account for any non-empty string. On Friday we'll combine our functions to decode a message.

Thanks for all your help yesterday, you guys are cool cats! Today's challenge will have you removing decoy characters from a string.

Write a function that, when given a non-empty string, and positive integer X, removes every Xth character from the string. Counting should begin from the first element in the string and should continue in that pattern until the end of the string.

For example:

// For the string below and 4
"Thies its H alltowe!en!? Th#is Tis GHalolowmeen$!"
// remove decoy strings
"This is Halloween! This is Halloween!"

// For the string below and 5
"The LBachyelor^ is ma tehrrib le tpelev!isioOn sh8ow."
// remove decoy strings and preach 🙌
"The Bachelor is a terrible television show."

🧩 Start Putting it Together

Tomorrow is day 7 of 7, and you'll be receiving a final function assignment as well as the task of putting all of your other functions from the week together in sequence.

If you like, you can get started on piecing together your functions today. Please remember that the functions must be performed on the provided string in order. If you do things out of order it will get messy very fast.

It is totally up to you how you want to organize your code. Some may choose to create a master decoding function that calls each helper function as needed, while others may prefer to chain the function calls separately. Up to you.

Note: Day 2 and Day 5 were side-projects, and their real purpose was to provide you with inputs for this final decoding. Day 2's key characters and Day 5's final count will be used as arguments for Day 3 and Day 6's functions, respectively.

Here's the encrypted string for the week, enjoy!

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

Do any of you have any guesses about what the message could be? I think it'll stay unsolved until tomorrow, but who knows?


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.

I

Don't know if I did something wrong, but as I could see, the letters in 'GHalolomeen$!' are not at the places that have 0 as the remainder of 4. The letter 'e' before another 'e' is in 44th place, and in 48th place is '!'. So when I remove every 4th, I get "Hallomen$". And yeah, the letter 'm' is in the spot where the letter 'w' should be :D

B
Barbara3y ago

yea it was a mix-up. Fixing :)

1

Huntober 2022 - Daily Coding Challenges

Part 8 of 13

My daily coding challenges for Huntober 2022. Each week has a topic focus and the daily challenges build upon each other toward a final week-end result!

Up next

String Week Challenge - Day 5

Cat-astrophic Overcommitment