String Week Challenge - Day 4

String Week Challenge - Day 4

Side Quests can be Beneficial

·

3 min read

Hello friends! Hope you're all having a great week so far and remembering to take care of yourselves!

⏰ Got some catching up to do?

Welcome! We're on day 4 of 7 of String Week. Please feel free to catch up and come on back:

⭐ 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 4

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.

Today's challenge is minor to give you all a bit of a break halfway through the challenge week, but there are a couple of side quests I'm going to throw out for those with extra time on their hands.

So far we've swapped out calculator characters, cleaned up after a cat and a preschooler, and placed some spaces. Today is simple! Given a string, reverse it. Any details like whitespace, letter casing, or punctuation should be preserved and flipped along with the rest of the string. For example:

"   The white space at the beginning of this string doesn't match the whitespace at the end. "
// reverse it
" .dne eht ta ecapsetihw eht hctam t'nseod gnirts siht fo gninnigeb eht ta ecaps etihw ehT   "

🏅 Some extra work

By now you should have written a function for each day so far. If not, go back and finish those up! Here are some things I'd suggest doing to build a deeper understanding of Strings and their manipulation:

  1. Explain your functions. Practice talking through your code.
  2. Check your function, parameter, and variable names. Good code should be clear to follow and should document itself.
  3. Rewrite your functions, taking a different approach. If you used String methods, try looping, and vice versa. Solve the problem via an alternate route and look for pros and cons of each.
  4. If you haven't yet, use the 4 functions you have so far (in order, Calculator fix -> Use the Day 2 key to add spaces -> Reverse the string), on our secret message. Compare your answer so far with others!

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.