<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joelle</title>
    <description>The latest articles on DEV Community by Joelle (@joellehelm).</description>
    <link>https://dev.to/joellehelm</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F238402%2F2c0404b1-f813-4b78-8e8b-a2c6d029c1ae.jpg</url>
      <title>DEV Community: Joelle</title>
      <link>https://dev.to/joellehelm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joellehelm"/>
    <language>en</language>
    <item>
      <title>How to draw a box on hover with CSS</title>
      <dc:creator>Joelle</dc:creator>
      <pubDate>Fri, 03 Jan 2020 15:05:27 +0000</pubDate>
      <link>https://dev.to/joellehelm/how-to-draw-a-box-on-hover-with-css-3bhn</link>
      <guid>https://dev.to/joellehelm/how-to-draw-a-box-on-hover-with-css-3bhn</guid>
      <description>&lt;p&gt;Hey everyone, I recently learned how to draw a box on hover using CSS and thought I would make a quick tutorial about it.&lt;/p&gt;

&lt;p&gt;First you'll need a word or link to hover over. In the example below I'll be using a class called .navA, here is what the html for this could look like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a&amp;gt;Hover&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next you'll want to open a css file that is connected to either your html file or your component if you're using react. We will use transition to draw the box over time. I want to draw my box starting from the bottom and go left to right. So first i'll write out transition and give it a border-bottom and then I can set how long it will take for that part of the border to show up. Repeat this step for each side of the border.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.navA {
  text-decoration: none;
  transition: border-bottom .2s, border-left .4s, border-top .6s, border-right .9s;

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cool now you know how to draw a box on hover with CSS. Play around with it and try changing the colors.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>css</category>
    </item>
    <item>
      <title>Make your cards pop on hover with CSS</title>
      <dc:creator>Joelle</dc:creator>
      <pubDate>Mon, 30 Dec 2019 02:25:29 +0000</pubDate>
      <link>https://dev.to/joellehelm/make-your-cards-pop-on-hover-with-css-1i39</link>
      <guid>https://dev.to/joellehelm/make-your-cards-pop-on-hover-with-css-1i39</guid>
      <description>&lt;p&gt;If you've ever wanted to change the color or opacity of something when you hover the mouse over it then this short tutorial is for you!&lt;/p&gt;

&lt;p&gt;First let's create a div and a card.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  &amp;lt;div class="container"&amp;gt;
     &amp;lt;div class="card"&amp;gt; 
       &amp;lt;h1&amp;gt;I'm a card!&amp;lt;/h1&amp;gt;
      &amp;lt;/div&amp;gt;
   &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next let's style the card. We will give it a border and change the sizing as well as centering the text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; .card {
    border: 3px solid black;
    background-color: green;
    width: 400px;
    height: 200px;
    opacity: 80%;
 }


 .card h1 {
    text-align: center;
 }

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now we can add changes on hover let's make the border thicker and change the opacity to 100% when the mouse hovers over the card. We can do this using :hover. Make sure you don't add a space between :hover and the class name. If you add a space it wont work properly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; .card:hover{
    border: 8px solid black;
    background-color: green;
    opacity: 100%;
 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now when we hover over the card it changes!&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>css</category>
    </item>
    <item>
      <title>How to add words inside a border in CSS</title>
      <dc:creator>Joelle</dc:creator>
      <pubDate>Mon, 30 Dec 2019 01:59:05 +0000</pubDate>
      <link>https://dev.to/joellehelm/how-to-add-words-inside-a-border-in-css-8nb</link>
      <guid>https://dev.to/joellehelm/how-to-add-words-inside-a-border-in-css-8nb</guid>
      <description>&lt;p&gt;I recently figured out how to put words into a border and thought I'd make a short tutorial on how to do it.&lt;/p&gt;

&lt;p&gt;First you'll need to create a border. Let's create a Div to add a border to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="border"&amp;gt;&amp;lt;h1 class="words"&amp;gt;Look at this div&amp;lt;/h1&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now let's give it a border using CSS. We will also add some margin spacing and change the width and height of the div.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; .border {
     border: 2px solid black;
     margin: 100px 100px 100px 100px;
     width: 600px;
     height: 400px;

 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next we will want to style the h1, we will give it a negative top margin so it will be within the border line, we will also give it a background color of white so the line behind it disappears. We set the left margin to 10px so the words aren't completely on the left side of the div, and finally we set the width to 220px so the entire top border line doesn't disappear.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; .words {
     margin-top: -17px;
     margin-left: 10px;
     background: white;
     width: 220px;
 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d5zYd6QP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vih1d374flazjrh8nd5h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d5zYd6QP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vih1d374flazjrh8nd5h.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to create cards on a grid with CSS</title>
      <dc:creator>Joelle</dc:creator>
      <pubDate>Mon, 30 Dec 2019 01:41:43 +0000</pubDate>
      <link>https://dev.to/joellehelm/how-to-create-cards-on-a-grid-with-css-4cpe</link>
      <guid>https://dev.to/joellehelm/how-to-create-cards-on-a-grid-with-css-4cpe</guid>
      <description>&lt;p&gt;Recently I've heard people having trouble creating cards on a grid in css, so I decided to make a quick tutorial to show you how to do that.&lt;/p&gt;

&lt;p&gt;First you'll want to create a div to be the container for the grid and connect your css file to your html file or react component if you're using react.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="cardContainer"&amp;gt;



&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let's go ahead and add some cards into our container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="cardContainer"&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div class="card"&amp;gt;&amp;lt;h2&amp;gt;Hello I'm a card&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next open your css file and set your display to grid, create margin spacing, and create your grid columns.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.cardContainer {

    margin: 100px 100px 100px 100px;
    display: grid;

    /* you can change the 4 below to 3 if you only want 3 cards per row */
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 40px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now you'll want to style your cards. You can make them any size you want, heres an example of some cards.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.card {
    width: 300px;
    height: 200px;
    color: white;
    background-color: red;
    text-align: center;
 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Cool now we have some cards on a grid. Play around with the sizing and see what you can create!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to connect CSS files to React components</title>
      <dc:creator>Joelle</dc:creator>
      <pubDate>Fri, 06 Dec 2019 01:04:34 +0000</pubDate>
      <link>https://dev.to/joellehelm/how-to-connect-css-files-to-react-components-1m3m</link>
      <guid>https://dev.to/joellehelm/how-to-connect-css-files-to-react-components-1m3m</guid>
      <description>&lt;p&gt;I recently learned React and realized it's completely different using CSS with React as opposed to vanilla javascript or html.&lt;/p&gt;

&lt;p&gt;In React you'll need to import your CSS file into the component you want to style directly.&lt;/p&gt;

&lt;p&gt;Let's say this is our CSS file. The goal here is to change the color of the text in our component. Let's assume we will have the class "text" already available.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.text {
  color: green;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You'll want to import your CSS file directly into the component you want to style.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from 'react';
import './Example.css'

class Example extends Component {


    render() {
        return (
            &amp;lt;div&amp;gt;
                &amp;lt;h1 className="text"&amp;gt;Hello&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
        );
    }
}

export default Example;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Cool now our text is green!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>CSS basics</title>
      <dc:creator>Joelle</dc:creator>
      <pubDate>Fri, 15 Nov 2019 22:32:10 +0000</pubDate>
      <link>https://dev.to/joellehelm/css-basics-5dia</link>
      <guid>https://dev.to/joellehelm/css-basics-5dia</guid>
      <description>&lt;p&gt;Hello, the purpose of this blog is to show people how to add CSS to an HTML file and how to select elements.&lt;/p&gt;

&lt;p&gt;First you'll need to add this to your HTML file.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" type="text/css" href="style.css"&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;href="style.css"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;style.css is the name of my CSS file in this example.&lt;/p&gt;

&lt;p&gt;Awesome now your HTML and CSS is connected. What next?&lt;/p&gt;

&lt;p&gt;Let's say this is your HTML file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;

    &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;


    &amp;lt;div class="div-class"&amp;gt;
        &amp;lt;card&amp;gt;
            &amp;lt;p id="p-tag"&amp;gt;
                &amp;lt;/p&amp;gt;
            &amp;lt;/card&amp;gt;
        &amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To select the div we can use the class selector. This will change any elements with the same class name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.div-class {}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To select the card we can use the element selector. This will change any elements of the same tag name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;card {}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To select the p tag we can use the id selector. This will only change the element with the selected id.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#p-tag {}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Once you have something selected to change you can do some cool things such as changing their color.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#p-tag {
color: green;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Play around with CSS and see what you can make!&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Evolve from .each with these helpful enumerables</title>
      <dc:creator>Joelle</dc:creator>
      <pubDate>Wed, 02 Oct 2019 14:17:21 +0000</pubDate>
      <link>https://dev.to/joellehelm/evolve-from-each-with-these-helpful-enumerables-25c</link>
      <guid>https://dev.to/joellehelm/evolve-from-each-with-these-helpful-enumerables-25c</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" alt="Ruby" title="Ruby"&gt;&lt;/a&gt;&lt;strong&gt;&lt;center&gt;&lt;h1&gt;&lt;code&gt;|map|&lt;/code&gt;&lt;/h1&gt;&lt;/center&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Ruby's &lt;code&gt;#map&lt;/code&gt; is an extremely useful upgrade from using &lt;code&gt;#each&lt;/code&gt;. Not only is it less code to write but it also looks much cleaner. Check out these examples of what &lt;code&gt;#map&lt;/code&gt; can do in the place of &lt;code&gt;#each&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;  &lt;span class="n"&gt;rainbow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"red"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"orange"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"yellow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"green"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"blue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"purple"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upcase&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;colors&lt;/span&gt;
  &lt;span class="c1"&gt;# returns ["RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "PURPLE"]&lt;/span&gt;


  &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upcase&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;# returns ["RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "PURPLE"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Pretty cool right! Ruby's &lt;code&gt;#map&lt;/code&gt; returns a new &lt;code&gt;array&lt;/code&gt; without changing the original one. If you were to use &lt;code&gt;#each&lt;/code&gt; you would need to create an empty &lt;code&gt;array&lt;/code&gt; to &lt;code&gt;shovel&lt;/code&gt; or &lt;code&gt;push&lt;/code&gt; the altered values into. You can use map to grab all of the things! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1yacSX0r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/r6vsmcn8zbh927cm1lug.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1yacSX0r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/r6vsmcn8zbh927cm1lug.jpg" alt="guy saying map all the things"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" alt="Ruby" title="Ruby"&gt;&lt;/a&gt;&lt;strong&gt;&lt;center&gt;&lt;h1&gt;&lt;code&gt;|select|&lt;/code&gt;&lt;/h1&gt;&lt;/center&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;What if you just wanted to grab specific things instead of mapping all of the things? Well you actually can with &lt;code&gt;#select&lt;/code&gt;!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; 
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
       &lt;span class="n"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;
     &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="n"&gt;colors&lt;/span&gt;
   &lt;span class="c1"&gt;# returns ["orange", "yellow", "purple"]&lt;/span&gt;


   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="c1"&gt;# returns ["orange", "yellow", "purple"]  &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;In this example we only grab colors with a length greater than 5. When using &lt;code&gt;#select&lt;/code&gt; a new array will be created and populated with the values we specify.&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" alt="Ruby" title="Ruby"&gt;&lt;/a&gt;&lt;strong&gt;&lt;center&gt;&lt;h1&gt;&lt;code&gt;|max_by|&lt;/code&gt;&lt;/h1&gt;&lt;/center&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;What if you want to grab the largest thing? You can use &lt;code&gt;#max_by&lt;/code&gt; to grab the max value of something.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;rainbow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"red"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"orange"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"yellow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"green"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"blue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"purpleee"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

   &lt;span class="n"&gt;longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;longest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt;
       &lt;span class="n"&gt;longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;
     &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="n"&gt;longest&lt;/span&gt;
   &lt;span class="c1"&gt;# returns "purpleee"&lt;/span&gt;


   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max_by&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="c1"&gt;# returns "purpleee"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can also specify how many values you want returned. The values returned are similar to using &lt;code&gt;#sample&lt;/code&gt; so the order will be random.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;rainbow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"red"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"orange"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"yellow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"green"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"blue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"purple"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

   &lt;span class="n"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
   &lt;span class="n"&gt;longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
   &lt;span class="n"&gt;second_longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
   &lt;span class="n"&gt;third_longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;longest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt;
       &lt;span class="n"&gt;third_longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;second_longest&lt;/span&gt;
       &lt;span class="n"&gt;second_longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;longest&lt;/span&gt;
       &lt;span class="n"&gt;longest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;
     &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;longest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;second_longest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;third_longest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;colors&lt;/span&gt;
    &lt;span class="c1"&gt;# returns ["purple", "orange", "yellow"]&lt;/span&gt;


   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max_by&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="c1"&gt;# returns ["purple", "orange", "yellow"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If our array looked like this &lt;code&gt;["red", "orange", "yellow", "greenn", "blue", "purple"]&lt;/code&gt; then any combination of 3 of these &lt;code&gt;["yellow", "greenn", "orange", "purple"]&lt;/code&gt; could have been returned.&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c_F_XByz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.emojidex.com/emoji/px32/Ruby.png" alt="Ruby" title="Ruby"&gt;&lt;/a&gt;&lt;strong&gt;&lt;center&gt;&lt;h1&gt;&lt;code&gt;|include?|&lt;/code&gt;&lt;/h1&gt;&lt;/center&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;What if we wanted to find out if our rainbow array has a certain color? We can do that by using &lt;code&gt;#include?&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; 
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"purple"&lt;/span&gt; 
       &lt;span class="kp"&gt;true&lt;/span&gt;
     &lt;span class="k"&gt;else&lt;/span&gt;
       &lt;span class="kp"&gt;false&lt;/span&gt;
     &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
   &lt;span class="c1"&gt;# returns true&lt;/span&gt;


   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;include?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"purple"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="c1"&gt;# returns true&lt;/span&gt;

   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;include?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"pink"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="c1"&gt;# returns false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Keep in mind that &lt;code&gt;include?&lt;/code&gt; returns true or false and not a new array.&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;&lt;h1&gt;&lt;code&gt;The magic of &amp;amp; with enumerables.&lt;/code&gt;&lt;/h1&gt;&lt;/strong&gt;&lt;br&gt;
We can even use this shorthand with enumerables when we don't need to pass in any arguments. This really blew my mind when I found out about it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;rainbow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="ss"&gt;:upcase&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="c1"&gt;# take note that the usual squigglys{} are now parentheses().&lt;/span&gt;
   &lt;span class="c1"&gt;# returns ["RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "PURPLE"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.giphy.com/media/wxw2e19ZMsjio/giphy.gif"&gt;&lt;img src="https://i.giphy.com/media/wxw2e19ZMsjio/giphy.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
