Skip to content

Instantly share code, notes, and snippets.

@hannahhch
Last active February 3, 2020 18:59
Show Gist options
  • Select an option

  • Save hannahhch/053c2b040ab213b5580fa42008f8432a to your computer and use it in GitHub Desktop.

Select an option

Save hannahhch/053c2b040ab213b5580fa42008f8432a to your computer and use it in GitHub Desktop.

Mutator & Accessor Methods

❄️ Snow Day Version ❄️

Learning Goals

  • Gain familiarity with other prototype methods (not necessarily JUST array prototypes, some string methods too!)
  • Understand why it’s important to note if a method is a mutator or accessor

Structure

On your own, research and take notes on the following methods:

  • sort
  • split and join
  • includes
  • concat
  • shift and unshift

Your notes should include the following information:

  • Name of the method
  • Short sentence on what it does or why you would use it
  • Does it mutate the original array? Yes or no
  • What does it take in?
  • What does it return?

In addition to researching, you should create at least 1 exercise for each method. (You may find that creating more than 2 examples and exercises is helpful)! Your exercise may look something like this:

// write a function called `findSnow()` that takes in a string 
// if the string includes the word "snow," console.log("Found some snow!")

Once you've created at least 7 exercises, send them to your project partner (AND ME) to solve (make sure they don't contain any solutions)!

We will meet back up at 11 to review and discuss any questions that came up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment