Giter Site home page Giter Site logo

programming-univbasics-4-array-simple-array-manipulations-part-2-sfo01-seng-ft-060120's Introduction

Introduction To Simple Array Manipulations - Part 2

Learning Goals

  • Identify the result of method calls on arrays
  • Perform simple array manipulations

Introduction

Now that we've covered the methods .push, .unshift, .pop, and .shift, we can take a look at a few more specific methods. Just like the last lab, write your methods in lib/introduction_to_simple_array_manipulation.rb using the descriptions below. Run learn to see the initial test failures, then periodically to see your progress.

Consult the official documentation on Ruby Arrays for the methods you need to use to solve the problems in this lab.

Perform Simple Array Manipulations

using_concat

This method takes in two parameters of two different arrays and uses the .concat method to add the contents of the second array to the first.

using_insert

This method takes in two parameters, an Array and a new element to be added to the array. it uses the .insert method to add the new element to the 4th index of the array.

using_uniq

This method takes in a parameter of an Array and uses the .uniq method to remove any duplicate items.

using_flatten

This method takes in a parameter of an Array that contains other arrays and uses the .flatten method to return an array of strings.

using_delete

This method takes in two parameters, an Array and a String, and uses the .delete method to remove any items from the array that are equal to that string.

using_delete_at

This method takes in two parameters, an Array and an Integer and uses the .delete_at method to delete the element at the index of the array that is equal to the provided integer.

Conclusion

You have now used the most common methods built into Ruby arrays! Everh Array can use these methods, giving you the power to modify them in whatever way you need!

Resources

programming-univbasics-4-array-simple-array-manipulations-part-2-sfo01-seng-ft-060120's People

Contributors

maxwellbenton avatar jenmyers avatar drakeltheryuujin avatar

Watchers

 avatar  avatar Victoria Thevenot avatar Bernard Mordan avatar Otha avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar  avatar  avatar Ben Oren avatar Matt avatar Antoin avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Ahmed avatar Nicole Kroese  avatar Kaeland Chatman avatar  avatar Lisa Jiang avatar Vicki Aubin avatar  avatar  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.