Step 19: Array Methods
Ruby has a ton of built-in methods that allow us to do cool stuff with arrays. One of the most important skills needed to be a successful developer is the ability to find, understand, and use documentation for the programming languages, frameworks, and other software you’re working with. All of the built-in methods for array in Ruby can be found at http://ruby-doc.org/core-2.3.1/Array.html. You can also find documentation for every other data type we’ve discusses and more at ruby-doc.org. Below are a few examples of other Array methods - check out what they do and read about them in the documentation.
fruits = ["apple", "banana", "mango", "banana", "orange", "lemon"] p(fruits.shuffle) p(fruits.uniq) p(fruits.rotate(2)) p(fruits.sort) p(fruits.clear)
It turns out that it's very useful to use
.inspect together as we did in the last example. So, we have this handy method
p that combines the two methods.