Array Week Challenge - Day 1

Array Week Challenge - Day 1

Are they really the same?

Oct 8, 2022ยท

3 min read

Hey everybody! Welcome to the first day of my second week of daily web dev challenges this October ๐ŸŽƒ.

These challenges are designed to be a bit of fun mixed with a bit of coding practice. Beginning each Saturday, the daily tasks will build towards discovering a final solution the following Friday. If that sounds like something you want in on, welcome!

โญ Here's how it works

  • Each week will have a cumulative goal
  • Each day I'll write a post with the challenge of the day
  • Check my Huntober Twitter for updates (and possible hints)
  • Save your code and solution from day to day! The challenges are cumulative
  • Please don't spoil it for everyone and share your answers without spoiler warnings
  • I'll share my approach and solutions each week
  • Have fun and maybe even learn some tricks!

โญ 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 1

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.

Do you know how to compare arrays? Not sure? Don't worry, you'll figure it out...

Today's task is to write a function that will check equality between 2 arrays with a particular structure.

The arrays will:

  • Be of equal size
  • Will each contain some number (X) arrays
  • Each inner array will contain that same number (X) primitive elements

All the nested primitives within each array must strictly match to return a true result. Any mismatches will return false.

For example:

// each of these arrays have 3 nested arrays of 3 strings each 
const arr1 = [['a','b','c'],['d','e','f'],['g','h','i']]

const arr2 = [['a','b','c'],['d','e','f'],['g','h','i']]
const arr3 = [['a','B','c'],['d','E','f'],['g','H','i']]
const arr4 = [['a','b','c'],['g','h','i'],['d','e','f']]

// if we were to use our function to compare all the possible pairs
// ONLY arr1 vs arr2 would return true

checkEquality(arr1, arr2) => true
checkEquality(arr1, arr3) => false
checkEquality(arr1, arr4) => false
// etc.

Good luck! Check back tomorrow for the next challenge of the week!

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.