<?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: Ian Ferrier</title>
    <description>The latest articles on DEV Community by Ian Ferrier (@ianferrier777).</description>
    <link>https://dev.to/ianferrier777</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%2F512431%2F71f7a52b-d8c8-453e-b1ed-a05974ce381a.png</url>
      <title>DEV Community: Ian Ferrier</title>
      <link>https://dev.to/ianferrier777</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ianferrier777"/>
    <language>en</language>
    <item>
      <title>Variables: Var, Let, Const - JavaScript Basics</title>
      <dc:creator>Ian Ferrier</dc:creator>
      <pubDate>Fri, 01 Jul 2022 03:09:16 +0000</pubDate>
      <link>https://dev.to/ianferrier777/variables-var-let-const-javascript-basics-819</link>
      <guid>https://dev.to/ianferrier777/variables-var-let-const-javascript-basics-819</guid>
      <description>&lt;p&gt;&lt;em&gt;Please note, for any of my dev blog posts, I am open to feedback and will make changes so long as I'm still active and can notice the changes. My brain isn't always screwed in all the way, all the time so I may not notice change requests. If you're new, pay attention to any comments that may be correcting information or adding necessary knowledge to this topic. The comments are welcome to more advanced knowledge of the topic or more information to topics related to this topic.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Why use variables?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Basic reason:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A variable is a place where you can store a value. You can make a variable called &lt;code&gt;firstName&lt;/code&gt; and give it the value of &lt;code&gt;'Tom'&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;It's like a box that stores what the value of something is. &lt;/li&gt;
&lt;li&gt;Lets say we put your first name into the figurative box, the value of the figurative box will be your first name. &lt;/li&gt;
&lt;li&gt;Imagine a program as sophisticated as everything you have to do to move from one home to another home. If you didn't label your boxes, you would regret that moving into the new home right? Heck you may even regret that moving everything into the transportation you are using! What if I stacked a bunch of heavy, robust stuff on a box I thought was full of heavy, robust stuff but actually was a box containing fragile stuff like glass kitchenware. Oopsies. &lt;/li&gt;
&lt;li&gt;In the most basic use case, we're giving something a label.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Another basic reason: give a reusable value a name and keep code clean
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Would you want to spell out (or copy and paste) "supercalifragilisticexpialidocious" every time I needed this in my code for some value? That would bring unnecessary and undesirable redundant code. We want reusable code. Always think about ways to make code reusable. &lt;/li&gt;
&lt;li&gt;Would you want to have this sophisticated looking word repeated every time its needed in the code? I would hope not, that would make my eyes want to cry. It looks gross.&lt;/li&gt;
&lt;li&gt;Lets take a look at using a variable to contain "supercalifragilisticexpialidocious" using the &lt;code&gt;var&lt;/code&gt; keyword.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;longWord&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;supercalifragilisticexpialidocious&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;longWord&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;longWord&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;See how nice that is? We eliminate the horrendously ugly value of "supercalifragilisticexpialidocious" (fun to say, hard to look at) and we've made it reusable. Let's see what it would look like without the variable.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;supercalifragilisticexpialidocious&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;supercalifragilisticexpialidocious&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;ul&gt;
&lt;li&gt;See? Looks gross. And redundant. And yes writing the variable name is redundant, but it's much better than writing the value multiple times.&lt;/li&gt;
&lt;li&gt;Another reason why this COULD be bad is that you're stating a value (the same exact value) twice in the program. I'm not entirely sure if Javascript will eat up more memory in this case rather than using the value of a single variable. It may not be the case, but some programming languages may do this from what I have seen. This bullet point is just a thought, not a fact.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Intermediate reason: A single "spot" to point to reference for a "spot" that experiences change.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Pardon the reason being a bit hard to understand. Hopefully I can clear it up.&lt;/li&gt;
&lt;li&gt;Lets say you need to add some values to a count one at a time. I need some way to track this count. Let's take a look:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;count&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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Yes I'm aware there is shorter ways to do this.&lt;/span&gt;
&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We've changed the value of &lt;code&gt;count&lt;/code&gt; from what it originally was. By the end of this code, the count will not be &lt;code&gt;0&lt;/code&gt;, it will be &lt;code&gt;42&lt;/code&gt; (Answer to life, the universe, and everything. Always remember to bring your towel). &lt;/li&gt;
&lt;li&gt;Programs will use a variable to change and manipulate a value to get a desired end result. &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  What the heck are &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;?
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Yeah! These two keywords are in the title, what do they do?&lt;/li&gt;
&lt;li&gt;Simple answer: they are two other ways to make a variable. But they have special powers. &lt;code&gt;var&lt;/code&gt; has many problems, but it's still needed since every browser hasn't quite caught up to the times with the more recent "versions" of JavaScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  JavaScript: Brief variable keyword history.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The initial decision makers of the earlier "versions" of JavaScript wanted weird things to apparently make JavaScript easier. In my opinion they actually managed to make things more difficult.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;var&lt;/code&gt; was the keyword these decision makers wanted for making variables.&lt;/li&gt;
&lt;li&gt;The problem with &lt;code&gt;var&lt;/code&gt; in a very brief description is when you declare a variable with &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;var&lt;/code&gt; variables can be accessed outside of areas you would expect them to exist. Lets say you have a home with a security system inside. You don't want the whole world to know what your security system is. Well in some weird cases using &lt;code&gt;var&lt;/code&gt; allowed for the outside to get access to that information (find out if you have a security system) or just access the variable itself (not the value) which means they could change that variable. Imagine if someone could just change the security system you own. Poof magic, you no longer have SimpliSafe, you have ADT. Absurd to think about but that's the general gist. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; come to the rescue! These two variable keywords don't bleed out into unusual areas causing the leaks we described &lt;code&gt;var&lt;/code&gt; potentially having. They are "block scoped", which basically in our security system variable for inside a home, that security system stays inside the "scope" of the home. It's not leaking out. Stays right in there.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; in action
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; allows us to also change and manipulate variable values much like &lt;code&gt;var&lt;/code&gt;. It can be used the counting code snippet above in place of &lt;code&gt;var&lt;/code&gt; without issue.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;const&lt;/code&gt; on the other hand blocks you from manipulating the value of something at all (to an extent). It's a constant. If you needed to get something on a wall in an exact location, you would probably use a wall, floor, and/or ceiling. A constant plane. Its plane of existence does no change. Unless you start breaking any of these things or these might be curved or not exactly straight, BUT for this example, let's just think of flat surfaces. You can't suddenly bring the wall 2 feet towards the center of the house (not easily at least). - &lt;code&gt;const&lt;/code&gt; variables are mainly used to assign a constant value. Maybe you have some function that makes a complicated evaluation according to the values you give it to solve for. When you get the solution, you may assign that value to a variable and not want it changed. You would use &lt;code&gt;const&lt;/code&gt; in this case. They serve a great purpose for "Read Only" values. Once you make the value, all you can do is read it.&lt;/li&gt;
&lt;li&gt;BUT &lt;code&gt;const&lt;/code&gt; doesn't prevent you from changing "stuff" within reference type values. If I assign a list to a &lt;code&gt;const&lt;/code&gt; variable, I could still change an item on that list. There are ways to protect this from happening, but in &lt;code&gt;const&lt;/code&gt;'s default state, you can change reference type values assigned to a &lt;code&gt;const&lt;/code&gt; variable.&lt;/li&gt;
&lt;li&gt;Once the value of a &lt;code&gt;const&lt;/code&gt; is assigned, you're not going to be able to change what it is. I can't change a &lt;code&gt;const&lt;/code&gt; variable with a reference type value to another reference type value. &lt;code&gt;const&lt;/code&gt; does protect that from happening. But it does not (as previously mentioned) prevent a reference type value assigned to the &lt;code&gt;const&lt;/code&gt; from being manipulated.&lt;/li&gt;
&lt;li&gt;If you use a primitive type value with &lt;code&gt;const&lt;/code&gt;, "that sucker ain't changin'" (pardon my non-proper lingo). If it's a number type value with the value of 10, then it's going to stay 10.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Basic examples of &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Still becomes 42.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;count&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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cm"&gt;/*
This is going to throw an error saying you can't do this along
with the following lines attempting to change the count.
"const".
*/&lt;/span&gt;
&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// In the end, count is gonna be zero. Can't change it.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Comments - JavaScript Basics</title>
      <dc:creator>Ian Ferrier</dc:creator>
      <pubDate>Thu, 16 Jun 2022 03:59:11 +0000</pubDate>
      <link>https://dev.to/ianferrier777/comments-javascript-basics-2j4c</link>
      <guid>https://dev.to/ianferrier777/comments-javascript-basics-2j4c</guid>
      <description>&lt;h2&gt;
  
  
  How to make comments:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Single Line Comments
&lt;/h3&gt;

&lt;p&gt;In order to make single line comments,&lt;br&gt;
you need to start the comment with two forward slashes, like so --&amp;gt; &lt;code&gt;//&lt;/code&gt;.&lt;br&gt;
Examples:&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;// I am a comment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;test&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// I can make comments like this too. &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;em&gt;This second example shows that a full line is not required to make a comment&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; You can technically use the multi line comment syntax (shown below) to make a single line comment.&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;/* I am comment */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Multi Line Comments
&lt;/h3&gt;

&lt;p&gt;You can also break comments out into multiple consecutive lines for larger comments.&lt;br&gt;
Examples:&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;/*
  I am a comment
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* I am
a
comment */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/*
  I am a comment
  I am a comment
  I am a comment
  I am a comment
  I am a comment
  I am a comment
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why make comments:
&lt;/h2&gt;

&lt;p&gt;Comments are used to make sense out of code you have wrote.&lt;/p&gt;

&lt;p&gt;However, you should avoid commenting about everything. You don't need to. You should only use comments to explain very unclear pieces of your code or a high level understanding of the purpose of a complex function, object, class, or anything else that just looks daunting at first glance and may need clarification.&lt;/p&gt;

&lt;p&gt;You should write code that is readable without comments. The code should explain itself. However, this is not always going to be the case.&lt;/p&gt;

&lt;h3&gt;
  
  
  Examples of good reasons for comments (open for criticism for the "good reason" comment examples):
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Snippet from a Tone.js demo I created
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="c1"&gt;// Reusable method for events to play the "Close Encounters of the Third Kind" Human communication to the aliens.&lt;/span&gt;
  &lt;span class="nx"&gt;closeEncountersHumans&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;synth2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Tone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Synth&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;toDestination&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;synth2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;volume&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;3&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;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Tone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;synth2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;triggerAttackRelease&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;G4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;synth2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;triggerAttackRelease&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;synth2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;triggerAttackRelease&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;F4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;synth2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;triggerAttackRelease&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;F3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;1.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;synth2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;triggerAttackRelease&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;C4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;short&lt;/span&gt; &lt;span class="nx"&gt;sweet&lt;/span&gt; &lt;span class="nx"&gt;overview&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;Class&lt;/span&gt; &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;created&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;You&lt;/span&gt; &lt;span class="nx"&gt;don&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;t need to go understand how it creates the object to create sound, you don&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="nx"&gt;need&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;explain&lt;/span&gt; &lt;span class="nx"&gt;why&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;volume&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;way&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;don&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;t need to go an interpret the rest of this. The variable name tries to explain it, but a comment might do this method more justice. Because its purpose and output may not be completely understandable and maybe somebody just needs a sound effect for a button click. They look around the app and stumble upon this method that can produce the `"Close Encounters of the Third Kind" Human communication to the aliens` sound effect on a button click. Easy peezy. Nothing crazy.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Old server code I made for a school project (incomplete router (lots missing), but a great example for this occassion):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Purpose:
This router handles the app's request routing and error
handling for Preflight OPTIONS, GET requests for the app's
background image default background or latest uploaded
background, GET requests for remote commands to client
application, and POST requests for client application 
commands from the client application itself.
*/&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;router&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&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="o"&gt;=&amp;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;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;OPTIONS&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&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;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&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;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;messageQueue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dequeue&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&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;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/background.jpg&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;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;readFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;backgroundImageFile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fileData&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&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="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fileData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;binary&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&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;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;next&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;ul&gt;
&lt;li&gt;There is a lot going on in this router. A good high level overview for all the possible requests that it handles will help a developer who may pick this up. Especially for a situation like this where as previous mentioned, this router was incomplete. It may be really nice for a developer on your team to quickly see in a couple of lines what this router is doing versus interpreting 20+ lines of code. Just so they can get a gauge of the "why" of each conditional checking the request url and what happens in each conditional block.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Examples of bad reasons for comments:
&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;const&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello World&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// I made this variable so our company's code can have a "Hello World" string.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You don't need to explain a variable for some primitive data type like a String type value. The use case for it should make sense wherever it is going to be used.
&lt;/li&gt;
&lt;/ul&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;aFunction&lt;/span&gt; &lt;span class="o"&gt;=&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;multipliedByTwo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&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;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&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="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&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="nx"&gt;multipliedByTwo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt; &lt;span class="c1"&gt;// This function iterates through the given array and returns a new array of values multiplied by two from the input array.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You may be thinking, "Why shouldn't I make a comment for this, it seems very complicated?". At first, learning any new language is complicated. But think about this: You wouldn't need to tell people the reason for eating an apple. You're eating an apple at the most highest level to gain nourishment.&lt;/li&gt;
&lt;li&gt;Code will like this will make sense throughout your learning. And it will make sense to others too. The &lt;code&gt;map&lt;/code&gt; method used here is a very common method used for iterating through an array to return another array with some manipulated values. It also can be used just to iterate through an array.&lt;/li&gt;
&lt;li&gt;As you learn and grow, just like learning whatever language(s) you have learned, you will gain intuition for when you should and should not use comments.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Goals of my blog.</title>
      <dc:creator>Ian Ferrier</dc:creator>
      <pubDate>Thu, 16 Jun 2022 03:47:08 +0000</pubDate>
      <link>https://dev.to/ianferrier777/goals-of-my-blog-be6</link>
      <guid>https://dev.to/ianferrier777/goals-of-my-blog-be6</guid>
      <description>&lt;p&gt;This post is for anyone who wants understand my motives here and this will serve as guideline for me to follow moving forward.&lt;/p&gt;

&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;Often throughout my professional careers, I found myself being the best version of myself when I could not only fully understand and perform tasks, but also if I could teach them and had everything documented for easy reference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Teaching
&lt;/h2&gt;

&lt;p&gt;I'll be giving small micro lessons in everything I know (regardless of the fact that this probably exists everywhere). Why would I repeat content folks have written about practically everywhere? Everyone learns concepts in totally different ways. My perspective I'm going to be offering might be the way someone needs to understand a concept or operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documenting
&lt;/h2&gt;

&lt;p&gt;Also, this will serve as my own personal reference for everything I know. I have come to realize that my documentation and records of research are lacking for my work, therefore this should help improve my notes for everything I have done.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Recursion</title>
      <dc:creator>Ian Ferrier</dc:creator>
      <pubDate>Wed, 09 Dec 2020 04:10:58 +0000</pubDate>
      <link>https://dev.to/ianferrier777/recursion-bgi</link>
      <guid>https://dev.to/ianferrier777/recursion-bgi</guid>
      <description>&lt;p&gt;With one small step, you can climb a mountain. &lt;/p&gt;

&lt;p&gt;I'm giving you a seed. This seed will grow you a tree of branches. This tree might have five branches coming up from the ground from where the seed was planted. This tree might grow eighteen branches from the initial seed location. It might be a normal tree and have one branch come up. Is this really even a tree? No time to ask questions just follow along, please. &lt;/p&gt;

&lt;p&gt;For every branch, another infinite number of possible branches could branch from these initial branches. And for these branches more infinite possible amount of branches could be arise from one branch. Here let me draw out maybe how ridiculous this tree might look like. The tree seed is "x".&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                     9
                    /
        1 -  x  - 5 - 8
           / | \    \
          2  3  4    7
          |
    10 -  6  - 15 
        / | \ 
      11 12 13
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Looks great right? Yeah no this is one ugly tree. I hate these trees. And please note every number here can have more branches, and those branches could have more branches, and so on. The bottom line is this is ridiculous, and trying to navigate this already is giving me a headache. I mean sure if I wanted to get to 9, I just need to go from x to 5 to 9 and boom I am done.&lt;/p&gt;

&lt;p&gt;But like I keep stressing, this tree could grow infinitely more and more branching out at each new branch in infinitely new ways.&lt;/p&gt;

&lt;p&gt;So let me ask you a question. What if I wanted you to make a whole new tree like this, but take all of these numbers in this tree and double them. Do whatever honestly. Change them in some way. How do you do that? What if you have a ridiculously bigger tree than this? What if you had several different variations of these kinds of trees and you just wanted a single way to get through these trees to make these changes?&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Tree1              Tree2               Tree3
      x                  x                   x
    / | \              / | \               / | \
   1  2  3            1  2  3             1  2  3  
                      |  |  |            /  / \  \  
                      4  5  6           4   5 6   7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;See these trees? Still annoying, but they are a little easier to look at. Premise will still be the same. First step to solving a problem that requires recursion is to simplify the problem however you can and make visuals like this, this will save you brain headaches. I have learned without visual representation my actual solution attempt will have major road blocks and hurdles because your brain can only think of so much at one time and the more complex something is, the harder it is to get your head to think and do the same thing.&lt;/p&gt;

&lt;p&gt;Solution time: &lt;/p&gt;

&lt;p&gt;Take notes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tree1 has a seed point and has 3 different branches. But those branches have nothing branching out of them. So it would seem to me that I should take note of that.&lt;/li&gt;
&lt;li&gt;Tree2 has branches with an additional branch for each initial branch. And again, at the end of the newest branches no new branches are there. &lt;/li&gt;
&lt;li&gt;Tree3 has one of those new branches getting a sibling branch, and has no child branch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's see if we can make this come together now where we can get some new trees with some changed values or something but same structure as the trees were are copying from.&lt;/p&gt;

&lt;p&gt;Tree1&lt;br&gt;
If I have a tree with only one set of initial branches, cool just do whatever changes you want on those initial branches and you have yourself a new tree that looks the same but with whatever you wanted changed is now changed.&lt;/p&gt;

&lt;p&gt;Tree2&lt;br&gt;
Hey I got child branches on these initial branches? But they don't have children though. So start with the first initial branch apply changes to it, then go through its children and make changes there, come back to the initial branches and do this same process for the 2nd and 3rd branch and their child branches. Kinda like going down and up and down and up and down and up. &lt;/p&gt;

&lt;p&gt;Tree3&lt;br&gt;
Now I have a similar case to where I started where I had 3 children and every branch only had one branch but NOW a branch way down has two branches! Well you solved this problem with Tree1. Iteration. In fact you have solved this iterating so many times so far now.&lt;/p&gt;

&lt;p&gt;So we have a thing in programming called a call stack that will remember where you are coming from as you go up and down. It'll remember the place you called a function from, and if you don't have anywhere else to go in that function, you just go back up to that function where you came from.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OyF1i2y1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0uf01rd9mjkjd43uob0u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OyF1i2y1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0uf01rd9mjkjd43uob0u.png" alt="Alt Text" width="880" height="649"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So you see myRecurFunc says hey go lets make call stack stuff happen, if where I am has children, I gotta go to each child right away, and same thing for their children, and so on and so on. Where I am though I also gotta change stuff so I have myFunc to do that along the ride! So once I take care of all cases where children are and I reach a point where no children are, I refer back to my call stack to where I came from and check again if children exist! Easy!&lt;/p&gt;

&lt;p&gt;Remember this monstrosity? This myRecurFunc can navigate this too! Its amazing! &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                     9
                    /
        1 -  x  - 5 - 8
           / | \    \
          2  3  4    7
          |
    10 -  6  - 15 
        / | \ 
      11 12 13
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;There you go, an attempt at me trying to explain recursion.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
