Array Week Challenge - Day 3

Array Week Challenge - Day 3

An oldie but goodie


2 min read

Heyyyyyy! It's the start of a work week but we're already 3 days into our challenge week. Let's do this!

⏰ You can Catch Up in no time!

We're on day 3 of this week's challenges which build upon each other.

Feel free to catch up:

and then head back over here!

I've also added all of this month's challenges to a series here on my blog - hope that helps!

⭐ Array Week

This week our challenges all deal with Arrays! Their purpose is to store a collection of things under a single reference name, but the way they are set up and used in JavaScript is a little different from other programming languages. If you're coming from a different language, be sure to check out what's different! While working on our challenges, feel free to use JavaScript's built-in Array methods.

🏆 The Challenge - Day 3

This week we'll be working with arrays toward a final puzzling result on Friday when we combine our daily functions. Your solutions should be built to work within any given daily constraints.

Today's challenge is a bit of a tangent, but I think it's pretty powerful. It's inspired by my favorite Codewars kata ever, Moving Zeros To The End. This is my favorite kata because the first time I did it, my approach was so convoluted compared to the top-voted solution, which was a thing of beautiful simplicity. I think the moment I saw that solution something clicked for me and I realized the power of the built-in Javascript methods.

Today I'd like you to write a function that:

  • takes in a given array of strings and move any entries containing the letter 'a' to the front
  • then move any remaining entries that have over 3 characters to the back
  • please preserve the relative order of entries within their given category


myArr = ['hi', 'hello', 'howdy', 'hola', 'hej', 'hallo', 'heyyy']
// move things around
=> ['hola', 'hallo', 'hi', 'hej', 'hello', 'howdy', 'heyyy']

Have 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.