Mutator & Accessor Methods

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

In your groups, you’ll be assigned to one or two prototype methods to research and poster:

  • Group 1: sort
  • Group 2: split and join
  • Group 3: includes
  • Group 4: concat
  • Group 5: shift and unshift

You will make a poster for your assigned prototype method (or two posters, if you are assigned two methods). Your poster 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?

Each group will present their poster to the class.

In addition to making a poster, your group should code up at least 2 examples of using the method. (You may find that creating more than 2 examples and exercises is helpful):

  • First repl: One person from your group will connect to th TVs and walk the class through how the method is being used and what it’s doing. When the explanation is complete, switch to your second repl -
  • Second repl: Send your second repl to the class in your public slack channel - this repl should not contain solutions, but simply practice exercises/prompts for the class to work on for a couple of minutes individually

Lesson Search Results

Showing top 10 results