Giter VIP home page Giter VIP logo

fewpjs-js-fundamentals-arrays-lab-nyc01-seng-ft-071320's Introduction

JavaScript Fundamentals: Arrays Lab

Learning Goals

  • Practice writing arrays
  • Practice manipulating arrays

Introduction

We've seen how arrays can be created and manipulated. Now we can practice putting it all together. To recap, push() pushes elements onto the ends of arrays, and pop() pops them off; similarly, unshift() adds elements to the beginnings of arrays, and shift() pulls them off. Now it's time to practice what we've learned.

Practice Writing Arrays

We're going to work with actions that mutate ("change") their underlying structures (like pop(), push(), shift(), and unshift()).

Generally, it's good practice to avoid mutating a program's state whenever possible. However, for now, we're going to focus on the fundamentals of working with Arrays.

  1. Run learn.
  2. Read the errors; vocalize what they're asking you to do.
  3. Write code; repeat steps 1 and 2 often until a test passes.
  4. Repeat as needed for further tests.
  5. Run learn submit when finished!

First, we're going to create four arrays of pets. Define 4 const called: append, prepend, removeLast and removeFirst, and set all to an initial value of ["Milo", "Otis", "Garfield"]. These are the arrays that we'll work with for each exercise.

NOTE: "Append" means "add to the end" and "prepend" means "add to the beginning."

Practice Manipulating Arrays

  1. Append the pet "Odie" to the end of append.
  2. Prepend the pet "Odie" to the beginning of prepend.
  3. Remove the last pet from removeLast.
  4. Remove the first pet from removeFirst.

Conclusion

We put our array knowledge into practice by writing and manipulating arrays. We also covered the concept of mutating state.

fewpjs-js-fundamentals-arrays-lab-nyc01-seng-ft-071320's People

Contributors

drakeltheryuujin avatar gj avatar jeffkatzy avatar jenmyers avatar jmburges avatar maxwellbenton avatar sgharms avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.