<?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: Cat</title>
    <description>The latest articles on DEV Community by Cat (@cat).</description>
    <link>https://dev.to/cat</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%2F72167%2F72cbb139-4e67-44d2-abe2-4453c1c65e36.jpg</url>
      <title>DEV Community: Cat</title>
      <link>https://dev.to/cat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cat"/>
    <language>en</language>
    <item>
      <title>An Open Letter to Newbies</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Mon, 14 Feb 2022 16:27:59 +0000</pubDate>
      <link>https://dev.to/cat/an-open-letter-to-newbies-3mh7</link>
      <guid>https://dev.to/cat/an-open-letter-to-newbies-3mh7</guid>
      <description>&lt;p&gt;Dear Newbie Developer,&lt;/p&gt;

&lt;h3&gt;
  
  
  This sh*t is hard.
&lt;/h3&gt;

&lt;p&gt;You're not going to like it at first, and by "it" I mean &lt;strong&gt;you will not like your first roadblock&lt;/strong&gt;. In fact, you might not like &lt;strong&gt;any&lt;/strong&gt; blockers, but you will encounter them regardless of experience level.&lt;/p&gt;

&lt;p&gt;Honestly, &lt;strong&gt;it's okay to cry&lt;/strong&gt;. It's okay to have a bit of an identity crisis when you encounter these difficulties. &lt;/p&gt;

&lt;p&gt;Identity crises are normal, but &lt;strong&gt;do not dwell on them for long.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As the lovely Kelly Clarkson sings: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What doesn't kill you makes you stronger&lt;/p&gt;

&lt;p&gt;Stand a little taller&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What doesn't kill you makes a fighter&lt;/p&gt;

&lt;p&gt;Footsteps even lighter&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Seriously, and I mean this literally:&lt;/p&gt;

&lt;h3&gt;
  
  
  just walk away.
&lt;/h3&gt;

&lt;p&gt;Get up and out of your coding space. &lt;/p&gt;

&lt;p&gt;Give yourself a 10-15 minute breather if you're on a deadline.&lt;/p&gt;

&lt;p&gt;Literally &lt;strong&gt;leave the room.&lt;/strong&gt; You don't need to go outside. Heck, I just walk to the kitchen and get more water or a nice snacko to reward myself with for even just the attempt.&lt;/p&gt;

&lt;p&gt;Forreal though, solutions usually come to me during breaks, especially after a good night's sleep or a nap.&lt;/p&gt;

&lt;p&gt;If there is one thing you need to remember throughout your dev journey in its entirety, it's really to just &lt;strong&gt;be kind to yourself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sure, there are prodigies that can regurgitate a translation from binary in 0.2 seconds-- but that's them and &lt;em&gt;not you&lt;/em&gt;, and  &lt;a href="https://getpocket.com/explore/item/in-defense-of-being-average" rel="noopener noreferrer"&gt;that is a good thing&lt;/a&gt; . &lt;/p&gt;

&lt;p&gt;What you bring to the table is valid and will always matter. There are ~7 billion people in the world, and maybe one of those 7 billion will find your way of writing or coding or whatever you do helpful/useful. Maybe what you say and how you convey it will resonate with someone, thereby making their journey a lot easier.&lt;/p&gt;

&lt;p&gt;Do you know how many tutorials, StackOverflow posts, and pages of our choice search engine we go through just to find a solution that makes sense to us?&lt;/p&gt;

&lt;p&gt;Do you know how many of those sources we have to  &lt;a href="https://dev.to/catcarbn/franken-code-till-you-make-it-1j41"&gt;cut and piece together&lt;/a&gt;  just for our code to &lt;em&gt;do the thing we want it to do&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;Newbie, I hear you. I was there before: tired, frustrated, ever-wondering what &lt;em&gt;this&lt;/em&gt; means. Do not give up, but also, do not strive for excellence-- especially at this stage.&lt;/p&gt;

&lt;p&gt;Right now, you're wondering why it's not working, even though you followed the instructions to the T. &lt;br&gt;
The best path to go at that point is to &lt;strong&gt;figure out a way to get it to work&lt;/strong&gt;. If that means writing 50 lines of 'if else' and 'else if', so be it. But as long as you're learning, as long as you know what it does &lt;strong&gt;you are making progress&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;...and after you understand that, THEN you can work on refinement and optimization.&lt;/p&gt;

&lt;p&gt;But for now, please, just remember to &lt;strong&gt;be kind to yourself&lt;/strong&gt; and get yourself a little snacko.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1605293969128%2F2AgmOykXx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1605293969128%2F2AgmOykXx.gif" alt="Pikachu eating a whole apple"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Thanks for reading!
&lt;/h2&gt;

&lt;p&gt;Let's keep in touch on  &lt;a href="https://twitter.com/catballar" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; !&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>mentalhealth</category>
    </item>
    <item>
      <title>The Difference Between React State vs Props</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Mon, 07 Feb 2022 16:39:21 +0000</pubDate>
      <link>https://dev.to/cat/the-difference-between-react-state-vs-props-1g04</link>
      <guid>https://dev.to/cat/the-difference-between-react-state-vs-props-1g04</guid>
      <description>&lt;p&gt;You may have heard the terms "stateful" and "lifting props" thrown around in the community for a while. &lt;/p&gt;

&lt;p&gt;Here's a TL;DR for you:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Props&lt;/strong&gt; cannot change, but &lt;strong&gt;State&lt;/strong&gt; can.
&lt;/h3&gt;

&lt;p&gt;But wait-- what does &lt;em&gt;that&lt;/em&gt; even mean?&lt;/p&gt;

&lt;p&gt;Think of working with polymer clay: the type of clay you can bake to set its shape.&lt;/p&gt;

&lt;p&gt;Brands you may recognize are Sculpey, Fimo, or Premo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feckonim70g4nh9899ht5.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feckonim70g4nh9899ht5.jpeg" alt="A multi-colored pile of blocks of polymer clay."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Think of the clay as information; let's say you want to create a figure of your D&amp;amp;D character. You mold the clay to &lt;em&gt;your&lt;/em&gt; vision, bake it, and paint it. You know how your character looks like: their mannerisms, style-- you don't need anyone else's &lt;em&gt;input&lt;/em&gt; on how to create your figure. You finish your character piece with confidence. &lt;/p&gt;

&lt;p&gt;This would be an example of a prop: no one else but you influences the look of the figure.&lt;/p&gt;

&lt;p&gt;However, if a friend commissions you for a custom D&amp;amp;D character piece, you need to mold and meld it to &lt;em&gt;their&lt;/em&gt; vision; therefore, you need &lt;em&gt;their input&lt;/em&gt; which could be changed in the middle of creation: "Pointy ears! Wait, no-- oh! Make them blonde--NO bald--NO! Covered in horns!"&lt;/p&gt;

&lt;p&gt;This is an example of state: the &lt;em&gt;state&lt;/em&gt; of the figure is constantly changing because your friend keeps &lt;em&gt;changing&lt;/em&gt; their &lt;em&gt;input&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1603924644426%2FLCufAmn04.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1603924644426%2FLCufAmn04.jpeg" alt="a sculpture of Link from Legend of Zelda"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I keep highlighting &lt;em&gt;input&lt;/em&gt; because, when dealing with React states, a common element that you will find yourself using state for are &lt;strong&gt;text fields&lt;/strong&gt;. That's because you will need &lt;em&gt;input&lt;/em&gt; from the user to set the information the state will hold! &lt;/p&gt;

&lt;p&gt;Whereas props (fun fact: it's short for "properties") are usually set pieces of information that the dev or client knows about and doesn't need user input to display.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, TL;DR:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;props&lt;/em&gt; === your character that you designed. No one else but you can change it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;state&lt;/em&gt; === your friend's character that you offered to design (and now probably regret because they keep &lt;em&gt;changing&lt;/em&gt; their mind). It is mutable by the public.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Thanks for reading!!
&lt;/h2&gt;

&lt;p&gt;I hope that wasn't confusing for you! If you have any questions or feedback, feel free to leave a comment below (and I will answer within 24-48 hours) or DM me on Twitter- &lt;a href="https://twitter.com/catballar" rel="noopener noreferrer"&gt;@catballar&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>How to Center a Div with CSS in 3 Steps!</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Mon, 31 Jan 2022 17:37:55 +0000</pubDate>
      <link>https://dev.to/cat/how-to-center-a-div-with-css-in-3-short-steps-4bi3</link>
      <guid>https://dev.to/cat/how-to-center-a-div-with-css-in-3-short-steps-4bi3</guid>
      <description>&lt;p&gt;Every dev's challenge: center a div.&lt;br&gt;
Nightmare mode: center it vertically AND horizontally.&lt;/p&gt;

&lt;p&gt;Well, you don't have to fret any longer! Here's a foolproof, short way to do it. All you need are two &lt;code&gt;elements&lt;/code&gt;: a container and your content.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Set up your HTML.
&lt;/h3&gt;

&lt;p&gt;This is very short and sweet: you just need two divs! I like to declare the class semantically so we'll call them &lt;code&gt;container&lt;/code&gt; and &lt;code&gt;content&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is some centered content&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Set up your container's CSS.
&lt;/h3&gt;

&lt;p&gt;We'll give container a &lt;code&gt;width&lt;/code&gt; of &lt;code&gt;100%&lt;/code&gt; and a &lt;code&gt;height&lt;/code&gt; of &lt;code&gt;100vh&lt;/code&gt;. This ensures that your canvas is covered.&lt;/p&gt;

&lt;p&gt;Then, we take care of what's inside by declaring &lt;code&gt;display: flex&lt;/code&gt;, &lt;code&gt;justify-content: center&lt;/code&gt;, and &lt;code&gt;align-items: center&lt;/code&gt;. This ensures your content is centered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: CSS - Set up your content.
&lt;/h3&gt;

&lt;p&gt;For the content itself, you're free to style this how ever you'd like. Since we don't have much content, I set the &lt;code&gt;width&lt;/code&gt; to &lt;code&gt;300px&lt;/code&gt;. You can also apply it as a percentage width to keep it responsive!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;300px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it! That's all you need to set your content at the absolute center. Here's a &lt;a href="https://codepen.io/catvscode/pen/RwjPXrm"&gt;codepen&lt;/a&gt; for your convenience to copy out of:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/catvscode/embed/RwjPXrm?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  Thanks for reading!!
&lt;/h2&gt;

&lt;p&gt;If you like my content, please give me a follow on &lt;a href="https://twitter.com/catcarbn"&gt;Twitter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>UX Case Study: Killer Kao</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Thu, 16 Dec 2021 19:29:32 +0000</pubDate>
      <link>https://dev.to/cat/ux-case-study-killer-kao-h98</link>
      <guid>https://dev.to/cat/ux-case-study-killer-kao-h98</guid>
      <description>&lt;p&gt;&lt;a href="https://catcarbonell.github.io/killerkao/"&gt;Live Demo&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/catcarbonell/killerkao"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Initial Design
&lt;/h2&gt;

&lt;p&gt;I wanted to create a different take on the classic "Rock-Paper-Scissors" JavaScript project by using &lt;a href="http://kaomoji.ru/en/"&gt;Kaomojis&lt;/a&gt; (the predecessor to our current, beloved emojis!)&lt;/p&gt;

&lt;p&gt;Here are some wireframes I initially created via Sketch:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7ko7z1v0j91g3q4d787.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7ko7z1v0j91g3q4d787.png" alt='I designed different screens in accordance to the possibilities a user would take, for example, the user would choose the "strike" button and the little fighter would change from a static pose to a punch pose' width="800" height="809"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(I was very much inspired by fighting games: Street Fighter, Tekken, King of Fighters, etc.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedback
&lt;/h2&gt;

&lt;p&gt;After I created the first iteration, I had friends and family test it out-- especially on mobile-- and was open to any and all feedback!&lt;/p&gt;

&lt;p&gt;This is from my older brother:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3thxejmifrozi4b7wx2h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3thxejmifrozi4b7wx2h.png" alt="Feedback from my older brother that pointed out the block button wasn't exactly working" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of my close friends' friend had feedback for me!&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4eglr3nyynh6inphegwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4eglr3nyynh6inphegwg.png" alt="My friend Patrick showed my game app to his friend and she had feedback for me. She suggested that I animate the kaomoji with CSS!" width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even Shen (&lt;a href="https://www.webtoons.com/en/challenge/shen-comix/list?title_no=129357&amp;amp;page=1"&gt;Shen Comix&lt;/a&gt;) took the time to try out my app!&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6a6pfwxgu0sfa218ljr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6a6pfwxgu0sfa218ljr.png" alt="A friend pointing out that there is no punishment or feedback from when you spam the strike button." width="800" height="648"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was even sent screenshots of when the Kaomoji would break:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesdevqonn8lmg286l84c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesdevqonn8lmg286l84c.png" alt="The kaomoji were off-screen thus indicating that the battlefield wasn't adjusting to the viewport properly." width="800" height="1733"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So I adjusted the Kaomoji structure accordingly, as well as came up with the logic to prevent block or strike "spamming" (hitting repeatedly with no consequences).&lt;/p&gt;

&lt;h2&gt;
  
  
  Postmortem lessons
&lt;/h2&gt;

&lt;p&gt;This was definitely a fun project, not just created by me, but by those in my community. I think I should have opened up feedback to a wider set of people, especially those who are fighting game enthusiasts. &lt;br&gt;
If I had the time, I would have implemented the choice to play as either a human or bear and made the kaomoji SVGs instead of the traditional text-made artistry to make it more accessible.&lt;/p&gt;

&lt;p&gt;If I had the tech savvy, I would have made it a two-player game instead of one-player against a random number generator.&lt;/p&gt;




&lt;p&gt;Here are the links again if you want to try out this project!&lt;br&gt;
&lt;a href="https://catcarbonell.github.io/killerkao/"&gt;Live Demo&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/catcarbonell/killerkao"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Thanks for reading!
&lt;/h2&gt;

&lt;p&gt;If you want to keep in touch, reach out to me via &lt;a href="https://twitter.com/catcarbn"&gt;Twitter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>ux</category>
      <category>beginners</category>
    </item>
    <item>
      <title>npm start Fatal Error Workaround</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Tue, 14 Dec 2021 03:43:57 +0000</pubDate>
      <link>https://dev.to/cat/udacity-react-course-fatal-error-workaround-40c5</link>
      <guid>https://dev.to/cat/udacity-react-course-fatal-error-workaround-40c5</guid>
      <description>&lt;p&gt;I was trying out &lt;a href="https://www.udacity.com/course/react-nanodegree--nd019"&gt;Udacity's React Nanodegree&lt;/a&gt; and found out (the hard way) that there are some things that Apple M1 users may run into.&lt;/p&gt;

&lt;p&gt;In short, there is this error you'll keep running into when you try to run &lt;code&gt;npm start&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;FATAL ERROR: wasm code commit Allocation failed - process out of memory&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;First thing: make sure Node is updated on your machine. You can check that by simply running &lt;code&gt;node&lt;/code&gt; in Terminal. Make sure it's higher than version 12.&lt;/p&gt;

&lt;p&gt;Next, &lt;code&gt;cd&lt;/code&gt; into your project folder, and then run&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nvm install node&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;This will ensure you have the latest version of Node specifically for your project, especially if you git clone'd the project straight from the linked Udacity repo.&lt;/p&gt;

&lt;p&gt;If all goes to plan, &lt;code&gt;npm start&lt;/code&gt; should compile successfully!&lt;/p&gt;




&lt;p&gt;Let me know in the comments if this worked (or not) for you!&lt;/p&gt;

</description>
      <category>react</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What I've Learned From Close-call Interviews</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Mon, 09 Nov 2020 17:58:52 +0000</pubDate>
      <link>https://dev.to/cat/what-i-ve-learned-from-close-call-interviews-224b</link>
      <guid>https://dev.to/cat/what-i-ve-learned-from-close-call-interviews-224b</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;You did great!! But...&lt;/p&gt;

&lt;p&gt;You did so well and the team loves you! However...&lt;/p&gt;

&lt;p&gt;You were SO CLOSE--&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I could tell from the sound of the recruiter's voice that, after a month of fretting, questioning my worth, building up my hope for a bright future for me, my fiancé, friends, and family-- everything has, once again, been pushed further out of my reach.&lt;/p&gt;

&lt;p&gt;This one hurt pretty bad, not gonna lie. I kept hearing positive feedback! I mean, we were talking compensation and when they would get started on drafting an offer. &lt;/p&gt;

&lt;p&gt;I really thought I had it.&lt;/p&gt;

&lt;p&gt;Then the rug gets pulled out from under me, &lt;em&gt;of course&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The most important thing I learned from this experience is:&lt;/p&gt;

&lt;h2&gt;
  
  
  Never, ever believe anything anyone says until the offer is in front of your face with your name on it.
&lt;/h2&gt;

&lt;p&gt;Remember: you always have control over your own actions, reactions, and decisions.&lt;/p&gt;

&lt;p&gt;And if they didn't pick you, it's their loss. Don't waste time fretting about why it wasn't you or singing the hymn of the impostor on repeat.&lt;/p&gt;

&lt;p&gt;It's fine to ask for feedback, just as long as you act on it and show improvement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Move on from the rejection as quickly as possible; time waits for no one.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is one way you recover from--yet another--rejection?
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thanks for reading!
&lt;/h3&gt;

&lt;p&gt;If you enjoyed this post or found it helpful, please share it on social media and/or check out my &lt;a href="https://buymeacoffee.com/catvscode" rel="noopener noreferrer"&gt;buymeacoffee&lt;/a&gt; page!! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/catvscode" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.buymeacoffee.com%2Fbuttons%2Fv2%2Fdefault-violet.png" alt="Buy Me A Coffee"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>mentalhealth</category>
    </item>
    <item>
      <title>How to Create Reusable Buttons to Trigger GSAP Animations in React!</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Wed, 30 Sep 2020 21:53:53 +0000</pubDate>
      <link>https://dev.to/cat/how-to-create-reusable-buttons-to-trigger-gsap-animations-in-react-549l</link>
      <guid>https://dev.to/cat/how-to-create-reusable-buttons-to-trigger-gsap-animations-in-react-549l</guid>
      <description>&lt;p&gt;I was determined to learn how to implement GreenSock animations into my shiny new portfolio/blog, and I discovered how to make this nifty component.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 0: npm i/yarn add the required dependencies:
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* React
* gsap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I am assuming you already have your base file/page you would be importing your ScrollBtn component into.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create your button component
&lt;/h2&gt;

&lt;p&gt;Make a ScrollBtn.js file in your Components folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Import GSAP and the ScrollToPlugin
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;gsap&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gsap/dist/gsap&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ScrollToPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gsap/dist/ScrollToPlugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Register the ScrollToPlugin
&lt;/h2&gt;

&lt;p&gt;This is an important step in the process. If you do not register the plugin, your app will fall over and you will be left wondering why.&lt;/p&gt;

&lt;p&gt;(Totally not speaking from experience.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;gsap&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gsap/dist/gsap&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ScrollToPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gsap/dist/ScrollToPlugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ScrollToPlugin&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Create your button!
&lt;/h2&gt;

&lt;p&gt;This component will call upon the use of props! This is the key to having it be reusable. All you need to do is give your target components/sections an id.&lt;/p&gt;

&lt;p&gt;Here is the base of the component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ScrollBtn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Click&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;scroll&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;ScrollBtn&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice there is an onClick attribute to our div/button.&lt;/p&gt;

&lt;p&gt;Let's create that function now!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Create trigger functionality
&lt;/h2&gt;

&lt;p&gt;This is where our ScrollToPlugin comes in.&lt;/p&gt;

&lt;p&gt;Above the return statement, create a function called handleClick and pass in e for "event" since this is an event listener.&lt;/p&gt;

&lt;p&gt;Don't forget to add e.stopPropagation() so that if your user -- for some odd reason or another -- hits the button repeatedly, the events won't bubble up/pile up on top of each other, which would really hurt your flow and experience.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ScrollBtn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stopPropagation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, add gsap and scrollTo functionality:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stopPropagation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;scrollTo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;offsetY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's quite a bit to explain here.&lt;/p&gt;

&lt;p&gt;First, according to the gsap syntax, we declare our overall target element that will be animated– in this case it's the entire window.&lt;/p&gt;

&lt;p&gt;"window" is a reserved keyword in JavaScript by default, that targets the user's viewport.&lt;/p&gt;

&lt;p&gt;Next, we declare our actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We want this to run fairly fast. By setting the duration to 1, it will take about 1 second for the animation to complete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I would recommend using a number between 0.5 and 2: you don't want the scroll to go so fast it gives the user a bit of vertigo just by glancing at your site, nor would you want it to take for. eh. ver. to get to your target section.&lt;br&gt;
*scrollTo is our main action, and it has its own set of keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For this we'll keep it simple and only declare our y -axis target and the offsetY so that the scroll doesn't stick the target section to the very top of our browser, but rather, off about 70 pixels to put it in a good space between the address bar and itself.&lt;br&gt;
(Spacing– padding and margin-- are very important elements to consider in UX/UI design.)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our y value is encased in a string literal since we will be tying this component to the base page via the React prop method. This is how components in React can communicate with each other throughout the app.&lt;/p&gt;

&lt;p&gt;Now, it's showtime!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: import your ScrollBtn component into your base file/page
&lt;/h2&gt;

&lt;p&gt;In this case, I created a "Components" directory beforehand, within the src directory, where my base file is located.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ScrollBtn&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Components/ScrollBtn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that you do not need to import gsap again– unless, of course, you're using a different animation for this page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Make sure you confirm the id of the target section
&lt;/h2&gt;

&lt;p&gt;Let's say the section id is "section-1". This is how I would tie our ScrollBtn to this page:&lt;/p&gt;

&lt;p&gt;Remember y: ${props.target} ?&lt;br&gt;
Here's how it works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ScrollBtn&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#section-1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;section-1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added the "#" because we are targeting an id.&lt;/p&gt;

&lt;p&gt;If all goes well, your button from wherever it is will trigger a scroll down or up to where "#section-1" is.&lt;/p&gt;

&lt;p&gt;Here's a working example in CodeSandbox:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/kwec2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  I hope that this tutorial was helpful to you!
&lt;/h2&gt;

&lt;p&gt;Let me know if it was by sharing this post on social media!&lt;/p&gt;

&lt;p&gt;Don't forget to tag me: &lt;a href="https://twitter.com/catvscode"&gt;@catvscode&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>react</category>
      <category>tutorial</category>
      <category>javascript</category>
    </item>
    <item>
      <title>My First Hackathon as a Developer</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Fri, 04 Sep 2020 23:53:21 +0000</pubDate>
      <link>https://dev.to/cat/my-first-hackathon-as-a-developer-3o45</link>
      <guid>https://dev.to/cat/my-first-hackathon-as-a-developer-3o45</guid>
      <description>&lt;h2&gt;
  
  
  Once upon a time, there was a 4-day hackathon.
&lt;/h2&gt;

&lt;p&gt;I signed up as a &lt;em&gt;Frontend developer&lt;/em&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Little did I know, at about the midpoint, half of my team dropped off the face of the Earth.
&lt;/h3&gt;

&lt;p&gt;Well, our PM fell ill and I have no idea where our growth marketer or our other UX designer went.&lt;/p&gt;

&lt;p&gt;I'm grateful that all the Software Engineers and one UX Designer stayed, but I had to &lt;em&gt;essentially&lt;/em&gt; take over as PM (in addition to being the frontend dev) for my team.&lt;/p&gt;

&lt;p&gt;It's how this tweet happened:&lt;br&gt;
&lt;iframe class="tweet-embed" id="tweet-1301359921938624512-155" src="https://platform.twitter.com/embed/Tweet.html?id=1301359921938624512"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1301359921938624512-155');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1301359921938624512&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;Honestly, though, I thought it was one of the most amazing experiences I've ever had as an engineer so far.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now about the project...
&lt;/h2&gt;

&lt;p&gt;We decided to create a delivery app that caters to listing local businesses-- so you won't see McD's or Target at the top of the app--or at all. &lt;br&gt;
We saw store after store closing in our hometowns due to COVID-19, and now we see how much of a necessity an online/digital presence is today.&lt;/p&gt;
&lt;h2&gt;
  
  
  Presenting: &lt;a href="https://hackathon-frontend-v01.vercel.app/"&gt;&lt;strong&gt;Us to You&lt;/strong&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/_vjpKb9iMBA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Essentially, we are the Ub*r E*ts for local businesses. The leads recommended that we at least use React and AWS Lambda (which we did use). We also decided to use Django as our backend. We had a fun collective rant about how "Serverless" isn't exactly serverless.&lt;/p&gt;

&lt;p&gt;I spear-headed the React frontend by establishing a generic landing with a sign-up/sign-in form. The growth marketer gave me a palette to work with as we were waiting for our UX designers to get back to us with wireframes. I deployed the first iteration prototype up to Vercel so that we can for sure at least have something to show, should we fall short of completion. (&lt;strong&gt;Spoilers:&lt;/strong&gt; we did, sadly.)&lt;/p&gt;

&lt;p&gt;To my surprise, I had to guide a couple of my university-based/CS major engineers on how to install git, how to navigate git, troubleshoot their Python dev environment-- it felt like I was already a senior dev. (It also felt very validating.) &lt;/p&gt;

&lt;p&gt;We established the backend, and another fullstack dev (and a fellow GA grad) got it to connect to AWS. &lt;br&gt;
We did receive a hi-fi mockup from our designer, but he had a VERY different color palette than what I was given. Thankfully, I used TailwindCSS and VSCode so making palette changes was easy-peasy.&lt;/p&gt;

&lt;p&gt;I enjoyed pair-programming with my teammates. I absolutely appreciated how fullstack dev &lt;a href="https://dev.to/gschnei"&gt;Gavi&lt;/a&gt; explained every step he was taking out loud -- something I really should do more (as opposed to constantly verbally threatening my code to work "OR ELSE").&lt;/p&gt;

&lt;p&gt;We had to record ourselves via Zoom pitching our idea. Our growth marketer at least left us with a mostly done powerpoint presentation. We just had to re-arrange it. I setup our meeting, did a couple of rehearsal pitches, and then we were done. &lt;/p&gt;

&lt;p&gt;4 days--done.&lt;/p&gt;




&lt;p&gt;I'll have another post describing my mental process on how to structure a TailwindCSS/React application!! I feel like I discovered part of myself while working on this project.&lt;/p&gt;

&lt;p&gt;Despite not winning or making it to top 3, this hackathon solidified my desire to stay in the tech industry and keep to keep applying to places as a full-time frontend engineer.&lt;/p&gt;




&lt;h2&gt;
  
  
  Thanks for reading!
&lt;/h2&gt;

&lt;p&gt;Check out my other posts on dev.to, and follow me on &lt;a href="https://twitter.com/catcarbn"&gt;twitter&lt;/a&gt;!&lt;br&gt;
Here's my portfolio if you're curious: &lt;a href="https://catcarbonell.dev"&gt;https://catcarbonell.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>career</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Interview Qs Decoded - # 2</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Thu, 11 Jun 2020 23:40:29 +0000</pubDate>
      <link>https://dev.to/cat/interview-qs-decoded-2-5eao</link>
      <guid>https://dev.to/cat/interview-qs-decoded-2-5eao</guid>
      <description>&lt;p&gt;I wanted to share with you all an actual challenge I was given during an interview!&lt;/p&gt;

&lt;p&gt;The interviewer said, "Alright, let's do some &lt;strong&gt;string reversals&lt;/strong&gt;!"&lt;/p&gt;

&lt;p&gt;I responded with this exact face:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fstz4ei0bsmg8eb0jyf69.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fstz4ei0bsmg8eb0jyf69.gif" alt="A very excited girl" width="480" height="253"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;The Q:&lt;/strong&gt; Write a function that accepts a string as a single argument, and when called, reverses the string.
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Restrictions:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You &lt;em&gt;cannot&lt;/em&gt; use &lt;strong&gt;.reverse()&lt;/strong&gt; or &lt;strong&gt;.reduce()&lt;/strong&gt;!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Edge Cases:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Punctuation does not matter&lt;/li&gt;
&lt;li&gt;Disregard numbers, we are only looking at strings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Given Argument:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Reverse me!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Setup:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;revFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;I asked the interviewer if I could use &lt;strong&gt;.split()&lt;/strong&gt;, and he said, "sure, go ahead."&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Protip: Always ask questions!!&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;revFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;splitString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What &lt;strong&gt;.split()&lt;/strong&gt; does is separate each character into individual indexes, making it into an array. I set it as a const variable &lt;strong&gt;splitString&lt;/strong&gt; so I could call on it later.&lt;/p&gt;

&lt;p&gt;Next, I thought of iterating through this new array, and so I utilized a &lt;strong&gt;classic for-loop&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;revFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;splitString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, what do I do when iterating through str? Yes, I need to go through them individually, but I need to iterate the other way. I asked if I could use &lt;strong&gt;.pop()&lt;/strong&gt; since pop removes the last item in an array. He gave me the go-ahead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;revFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;splitString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
      &lt;span class="c1"&gt;// --------&lt;/span&gt;
      &lt;span class="nx"&gt;splitString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="c1"&gt;// --------&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But we need that last letter! We can't just send it into the abyss! My solution to hold the popped item was to &lt;strong&gt;.push()&lt;/strong&gt; it into a new, empty array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;revFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;splitString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="c1"&gt;// --------&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reversedString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
   &lt;span class="c1"&gt;// --------&lt;/span&gt;
   &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
      &lt;span class="c1"&gt;// --------&lt;/span&gt;
       &lt;span class="nx"&gt;reversedString&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="nx"&gt;splitString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
      &lt;span class="c1"&gt;// --------&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, if we console.log the revFunction, it will return as an array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// [!,e,m, ,e,s,r,e,v,e,R]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Success!&lt;/p&gt;

&lt;p&gt;But, the interviewer wanted the function to return a solid string. I asked if I could use &lt;strong&gt;.join()&lt;/strong&gt;. He approved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;revFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;splitString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reversedString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
   &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
       &lt;span class="nx"&gt;reversedString&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="nx"&gt;splitString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="c1"&gt;// ---- //&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;reversedString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="c1"&gt;// ---- //&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should return:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//!em esreveR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;We did it! There are many ways to reverse a string without the &lt;strong&gt;.reverse()&lt;/strong&gt; method. What I covered was the &lt;strong&gt;iterative&lt;/strong&gt; way (&lt;em&gt;iterating&lt;/em&gt; with a for-loop). &lt;/p&gt;

&lt;h2&gt;
  
  
  I challenge you to solve this challenge (in your language of choice) in the comments!
&lt;/h2&gt;




&lt;h3&gt;
  
  
  &lt;a href="https://repl.it/@catcarbonell/reverseString"&gt;Try it out on my Repl!&lt;/a&gt;
&lt;/h3&gt;




&lt;h3&gt;
  
  
  Thanks for reading!!
&lt;/h3&gt;

&lt;p&gt;Got a beginner-level interview question for me? DM me on &lt;a href="https://twitter.com/catcarbn"&gt;Twitter!&lt;/a&gt; I'm always up for challenges!&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>javascript</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Interview Qs Decoded - # 1</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Tue, 02 Jun 2020 20:30:22 +0000</pubDate>
      <link>https://dev.to/cat/interview-q-s-decoded-issue-1-40i3</link>
      <guid>https://dev.to/cat/interview-q-s-decoded-issue-1-40i3</guid>
      <description>&lt;p&gt;Hello everyone! Welcome to the first in a series! I'm going to try to explain a common software engineering interview question to better understand it and hopefully remember it when the time comes!&lt;/p&gt;

&lt;p&gt;These problems will primarily be solved in JavaScript, as that is my language of choice when testing (and I just want to become a good front-end dev. 🥺)&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Q: Find the second largest number in a given array.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Params&lt;/strong&gt;: We are given an array of whole, positive integers (no negative numbers or floats). We are to write a function and return the second largest integer.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Let's start!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We'll write the skeleton of our function, setting the input/argument as &lt;strong&gt;"arr"&lt;/strong&gt; for &lt;em&gt;array&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secondLargest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we'll need to set two empty variables: &lt;em&gt;largest&lt;/em&gt; and &lt;em&gt;second&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; We will need placeholders for both our prospective &lt;strong&gt;largest&lt;/strong&gt; and &lt;strong&gt;second&lt;/strong&gt; largest numbers as we loop through our array. &lt;br&gt;
We want to keep track of each integer that is in the array and measure the value against the others&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secondLargest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt; 
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...Which brings us to our next step: &lt;strong&gt;create a for-loop!&lt;/strong&gt;&lt;br&gt;
As we iterate through the array, we will measure each value against each other, comparing the variable "largest" to the current iteration value (arr[i]).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secondLargest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){};&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To compare, we will create an &lt;strong&gt;if-statement&lt;/strong&gt; comparing &lt;strong&gt;largest&lt;/strong&gt; to &lt;strong&gt;arr[i]&lt;/strong&gt;. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If &lt;strong&gt;arr[i]&lt;/strong&gt; is greater than &lt;strong&gt;largest&lt;/strong&gt;, then &lt;em&gt;replace it&lt;/em&gt; with the current value of &lt;strong&gt;arr[i]&lt;/strong&gt; by redeclaring &lt;strong&gt;largest&lt;/strong&gt; and setting it equal to &lt;strong&gt;arr[i]&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secondLargest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
           &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
       &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We found the largest number! But how do we get the &lt;strong&gt;second&lt;/strong&gt; largest?&lt;br&gt;
We did find it already (kind of): we'll just set the former "largest" number to the "second" variable.&lt;/p&gt;

&lt;p&gt;HOWEVER, we must declare the &lt;strong&gt;second&lt;/strong&gt; variable BEFORE we declare the new &lt;strong&gt;largest&lt;/strong&gt; number, simply because &lt;em&gt;order matters&lt;/em&gt;-- JavaScript executes code from the top-down.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secondLargest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
           &lt;span class="c1"&gt;//&lt;/span&gt;
           &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
           &lt;span class="c1"&gt;//&lt;/span&gt;
           &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt; 
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Speaking of order and specificity, it's time we find the "true" second-largest number in the array.&lt;/p&gt;

&lt;p&gt;Let's create another if-statement with more specific parameters:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If the &lt;strong&gt;arr[i]&lt;/strong&gt; is GREATER THAN &lt;em&gt;second&lt;/em&gt; &lt;strong&gt;AND&lt;/strong&gt; LESS THAN &lt;em&gt;largest&lt;/em&gt;, then set &lt;strong&gt;arr[i]&lt;/strong&gt; as &lt;em&gt;second&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secondLargest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
           &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
           &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="c1"&gt;//&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
           &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="c1"&gt;// &lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we'll return our &lt;em&gt;second&lt;/em&gt; variable to complete the requirement.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secondLargest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
           &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
           &lt;span class="nx"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
           &lt;span class="nx"&gt;second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;And there you have it! It's a fairly simple solution, a bit long since we're using a traditional for-loop, but it works!&lt;/p&gt;

&lt;p&gt;Feel free to post your own solutions in your programming language of choice in the comments!&lt;/p&gt;




&lt;h3&gt;
  
  
  Thanks for reading!
&lt;/h3&gt;

&lt;p&gt;If you'd like to keep in touch, please reach out to me on &lt;a href="https://twitter.com/catcarbn"&gt;Twitter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>career</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Function Composition Explained Using Pokémon Evolution</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Thu, 28 May 2020 22:35:56 +0000</pubDate>
      <link>https://dev.to/cat/function-composition-explained-using-pokemon-evolution-1jhn</link>
      <guid>https://dev.to/cat/function-composition-explained-using-pokemon-evolution-1jhn</guid>
      <description>&lt;p&gt;Yo, (scarf) dog. I heard you like functions, so I put a function in ur function so that you can function while it functions.  &amp;lt; / oldMemes &amp;gt;&amp;lt; / badJoke &amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/oabY4xGwzUB8c/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/oabY4xGwzUB8c/giphy.gif" alt="Eevee shaking their head, disapproving of my bad joke" width="540" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ANYWAY, so my friend was starting to learn how to code and she needed help with understanding what the teacher was asking her to do.&lt;/p&gt;

&lt;p&gt;This is what she sent me:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/*
Create a function that takes in two inputs.
One should be a function and the other should be
the argument to call the input function with.

Then in the function you define call the passed in function
with the input argument. 
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...excuse me, but lolwut?&lt;/p&gt;

&lt;p&gt;Here's the example function she sent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sayHi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Greet me!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;b&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Okay, that's a bit more clear, I guess.&lt;/p&gt;




&lt;h2&gt;
  
  
  So, here we go:
&lt;/h2&gt;

&lt;p&gt;From what I understand, we're looking to build a function that runs another function. I used the concept of &lt;strong&gt;Pokémon evolution with stones&lt;/strong&gt; to illustrate this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/41fc5hcRsUBqotI7WD/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/41fc5hcRsUBqotI7WD/giphy.gif" alt="Eevee evolving in the Detective Pikachu movie" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;Evolution&lt;/em&gt; is the overall universal function.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;evolutionFn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pokemon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;stone&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;stone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Which stone will you use?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;pokemon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stone&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pokémon themselves are separate functions, but still universally utilize the same evolution function. The best example to use would be &lt;strong&gt;Eevee&lt;/strong&gt; because the possibilities of their evolution are vast. (But for now, we're referencing their basic gen 1 evolutions).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/133cAiXr4T1te/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/133cAiXr4T1te/giphy.gif" alt="Eevee tossing a flower crown onto their head" width="500" height="526"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;eevee&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fire&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Flareon!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;thunder&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Jolteon!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;water&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Vaporeon!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Huh. It didn&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;t work.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also created Pikachu to illustrate that a completely different Pokemon can utilize this method of evolution as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/Fbj7lIkDbwNLa/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/Fbj7lIkDbwNLa/giphy.gif" alt="Raichu spinning Pikachu around while dancing" width="500" height="342"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pikachu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;thunder&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Raichu!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Huh. It didn&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;t work.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put it all together and we get the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;evolutionFn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pokemon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;stone&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;stone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Which stone will you use?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;pokemon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stone&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;eevee&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fire&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Flareon!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;thunder&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Jolteon!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;water&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Vaporeon!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Huh. It didn&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;t work.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pikachu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;userInput&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;thunder&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Congrats! You now have a Raichu!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Huh. It didn&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;t work.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;evolutionFn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eevee&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// example: if prompt =&amp;gt; 'fire or FIRE or even FiRe', &lt;/span&gt;
&lt;span class="c1"&gt;// it will say "Congrats! You now have a Flareon!"&lt;/span&gt;
&lt;span class="c1"&gt;// if it's anything else, the console will return "Huh. It didn't work."&lt;/span&gt;


&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;evolutionFn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pikachu&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Should return "Congrats you now have a Raichu"! etc. etc.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Play with it live on &lt;a href="https://repl.it/@catcarbonell/evolvefn"&gt;Repl.it&lt;/a&gt;&lt;/strong&gt;!
&lt;/h2&gt;




&lt;p&gt;And there you have it-- &lt;strong&gt;Function composition: when you want to use a big function to execute little functions that essentially will output the same basic thing.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Also, fun fact-- you've been bamboozled! If you've ever used .map(), .split(), .join(), .reverse(), you have already experienced Function Composition! We see this in action when we use JavaScript methods &lt;em&gt;ALL. THE. TIME.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Thanks for reading!
&lt;/h2&gt;

&lt;p&gt;If you'd like to keep in touch with me, follow me on &lt;a href="https://twitter.com/catcarbn"&gt;Twitter&lt;/a&gt;! DMs are open.&lt;/p&gt;

&lt;p&gt;Also, &lt;a href="https://catvscode.substack.com"&gt;sign up for my newsletter&lt;/a&gt; where I give you tips/tricks on how to survive coding bootcamp and post-bootcamp/learning on your own by sharing some personal (sometimes embarassing) stories!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Explain Microsoft Azure Like I'm 5!</title>
      <dc:creator>Cat</dc:creator>
      <pubDate>Wed, 20 May 2020 18:09:31 +0000</pubDate>
      <link>https://dev.to/cat/explain-microsoft-azure-like-i-m-5-3lfn</link>
      <guid>https://dev.to/cat/explain-microsoft-azure-like-i-m-5-3lfn</guid>
      <description>&lt;p&gt;I'm getting curious about DevOps, and Azure came up in conversation. &lt;/p&gt;

&lt;p&gt;Without technical jargon, I pose this challenge to you!&lt;/p&gt;

&lt;p&gt;Winner receives a sticker pack from me!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>codenewbie</category>
      <category>explainlikeimfive</category>
    </item>
  </channel>
</rss>
