<?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: Gabrielle Davidson</title>
    <description>The latest articles on DEV Community by Gabrielle Davidson (@gabriellend).</description>
    <link>https://dev.to/gabriellend</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%2F711538%2Fe36c0552-0cb1-4558-8900-a9ac2f6ee5cf.jpeg</url>
      <title>DEV Community: Gabrielle Davidson</title>
      <link>https://dev.to/gabriellend</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gabriellend"/>
    <language>en</language>
    <item>
      <title>What is asynchronous JavaScript?</title>
      <dc:creator>Gabrielle Davidson</dc:creator>
      <pubDate>Wed, 22 Dec 2021 00:56:18 +0000</pubDate>
      <link>https://dev.to/gabriellend/what-is-asynchronous-javascript-32g5</link>
      <guid>https://dev.to/gabriellend/what-is-asynchronous-javascript-32g5</guid>
      <description>&lt;h2&gt;
  
  
  First understand synchronous JavaScript
&lt;/h2&gt;

&lt;p&gt;This means that you do one thing at a time. This is JavaScript in its natural state. Not all languages are like this. Consider the following code:&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="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="mi"&gt;1&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="mi"&gt;2&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="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When this is run, 1, 2, and 3 will appear in order in the console, like this:&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="mi"&gt;1&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We start with the first line, when it is finished we move to the second line, and so on.&lt;/p&gt;

&lt;p&gt;This works fine for simple projects, but if you want to build any kind of actually functioning web app, you'll need to start making server requests. The problem is, we don't really know when the server is going to respond with the information we need. With synchronous JavaScript, that creates a problem – waiting.&lt;/p&gt;

&lt;p&gt;Remember, we can't move on to the next task until the present task is complete. That creates a very unpleasant and clunky user experience. What can be done to solve this?&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter asynchronous JavaScript
&lt;/h2&gt;

&lt;p&gt;Asynchronous JavaScript allows us to move on to the next task while we wait for an answer (i.e. a "callback") from the server. It's a bit of a misnomer because JavaScript itself isn't what's asynchronous, it's other mechanisms that JavaScript can interact with that enable that capability.&lt;/p&gt;

&lt;p&gt;Let's consider the diagram below:&lt;br&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%2Fw092kmxdwgds5g6t7teh.png" 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%2Fw092kmxdwgds5g6t7teh.png" alt="Diagram of asynchronous JavaScript flow"&gt;&lt;/a&gt;&lt;br&gt;
JavaScript runs in the browser, which also takes care of storing information(Memory Heap) and the order in which tasks are completed(Call Stack). The &lt;em&gt;Web APIs, Callback Queue,&lt;/em&gt; and &lt;em&gt;Event Loop&lt;/em&gt; you see are what makes asynchronous code work.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Let's change our code from the beginning just a little:&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="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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;setTimeout&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;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="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;3000&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="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will give us 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="mi"&gt;1&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I was surprised when I learned that &lt;em&gt;setTimeout()&lt;/em&gt; is not actually JavaScript, it's an API! It allows you to wait three seconds (in this case) before calling &lt;em&gt;console.log(2)&lt;/em&gt; (simulating a server request). Meanwhile, the browser is free to move on to the next line. That is why '3' appears before '2'. This is asynchronous JavaScript in action.&lt;/p&gt;

&lt;h3&gt;
  
  
  Going a little deeper
&lt;/h3&gt;

&lt;p&gt;Here is how the above is actually broken down according to our diagram. Start with the number 1 and follow all the way to 7:&lt;br&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%2Fa2jdn2a4xghaz8fix86u.png" 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%2Fa2jdn2a4xghaz8fix86u.png" alt="Asynchronous JavaScript flow in detail"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The browser reads the first line of code. It understands that this can be done right away. &lt;/li&gt;
&lt;li&gt;It moves the function to the call stack. No other functions are necessary for this one to run so &lt;/li&gt;
&lt;li&gt;It is popped off the call stack, executed, and the result appears in the console.&lt;/li&gt;
&lt;li&gt;The browser reads the second line of code. It understands it will have to wait for the result so it hands the task off to players behind the scenes and moves on.&lt;/li&gt;
&lt;li&gt;The browser reads the third line of code. It understands that this can be done right away.&lt;/li&gt;
&lt;li&gt;Repeat step 2.&lt;/li&gt;
&lt;li&gt;Repeat step 3.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While steps 5-7 were happening, the setTimeout() function was handed off to the Callback Queue and the Event Loop began checking the Call Stack to see if it was empty. When it was, the setTimeout() function was moved to the Call Stack and executed as normal. So, we were able to do more than one thing at a time. This is asynchronous JavaScript.&lt;/p&gt;

&lt;p&gt;Delve even deeper in this &lt;a href="https://blog.sessionstack.com/how-does-javascript-actually-work-part-1-b0bacc073cf" rel="noopener noreferrer"&gt;article&lt;/a&gt; by &lt;a href="https://medium.com/@zlatkov" rel="noopener noreferrer"&gt;Alexander Zlatkov&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>What is an API?</title>
      <dc:creator>Gabrielle Davidson</dc:creator>
      <pubDate>Wed, 20 Oct 2021 00:30:11 +0000</pubDate>
      <link>https://dev.to/gabriellend/what-is-an-api-fl5</link>
      <guid>https://dev.to/gabriellend/what-is-an-api-fl5</guid>
      <description>&lt;p&gt;&lt;em&gt;API&lt;/em&gt;, or &lt;em&gt;Application Programming Interface&lt;/em&gt;, is one of the many acronyms thrown around in the programming world. It took me months to grasp the concept, not least because APIs can look very different from each other, depending on what they are trying to accomplish.&lt;/p&gt;

&lt;p&gt;The best, high-level conceptualization I've come up with that encapsulates them all is that &lt;strong&gt;APIs are a simplified way to interact with complex information&lt;/strong&gt;. That still sounds kind of vague. Let's look at some examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real world
&lt;/h2&gt;

&lt;p&gt;The picture in the header of this article shows an old radio. We can actually think of this radio, with its three dials, as an API for transforming radio waves into sound and having some control over them.&lt;/p&gt;

&lt;p&gt;We don't have a way to directly access radio waves without a radio. Nor would we probably want to, that's a lot of complex information to handle. So, someone devised this simple &lt;em&gt;interface&lt;/em&gt; that gives us the ability to switch between different frequencies, control the volume, and turn the radio off and on.&lt;/p&gt;

&lt;p&gt;There is a lot more you could do with radio waves that has nothing to do with listening to music, but we don't need to be bogged down with all that stuff. The radio API just gives us what we need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Programming world
&lt;/h2&gt;

&lt;p&gt;Similarly, in the programming world, we frequently want to easily incorporate data from other complex sources to make our projects more dynamic and useful.&lt;/p&gt;

&lt;p&gt;Let's say I'm making a weather app. How do I get the weather data to display on my home screen? Do I have to collect and maintain it all myself? Lucky for me, someone else has already done that and created an &lt;em&gt;API&lt;/em&gt; that allows me to access and use that data. It doesn't have physical dials but there are instructions on how to use it and it only gives me what I need, not the hoards of information that come with monitoring the weather, just like the radio.&lt;/p&gt;

&lt;p&gt;This is great news! Not only do I not have to collect my own data, I also don't have to spend an inordinate amount of time sifting through someone else's data. This saves me a lot of time.&lt;/p&gt;

&lt;p&gt;It also allows the creator of the API to let other people use some of their data while keeping some private. This might be like how Pinterest provides an API for your website to use its icon to save something to a board without having to give you all of its user or proprietary information. You get to give your users the ability to harness the power of Pinterest and Pinterest gets to reach more people. It's a win-win for everyone!&lt;/p&gt;

&lt;h2&gt;
  
  
  The wonderful world of APIs
&lt;/h2&gt;

&lt;p&gt;APIs are everywhere and there are all kinds. There is a &lt;a href="http://swapi.py4e.com/"&gt;Star Wars API&lt;/a&gt; and a &lt;a href="http://numbersapi.com/#42"&gt;number facts API&lt;/a&gt;. Large companies like &lt;a href="https://rapidapi.com/collection/facebook-apis"&gt;Facebook&lt;/a&gt; have APIs. Here is a &lt;a href="https://public-apis.xyz/"&gt;collection&lt;/a&gt; of a bunch of other APIs. Whatever you're looking for, there is probably an API for it. You'll need to understand server requests and asynchronous javascript in order to fully work with them but hopefully this gives you a better understanding of what they even &lt;em&gt;are&lt;/em&gt;. And once you get used to them, they are a lot of fun!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to animate the moon with the canvas element</title>
      <dc:creator>Gabrielle Davidson</dc:creator>
      <pubDate>Mon, 11 Oct 2021 03:29:42 +0000</pubDate>
      <link>https://dev.to/gabriellend/how-to-animate-the-moon-with-the-canvas-element-2kk5</link>
      <guid>https://dev.to/gabriellend/how-to-animate-the-moon-with-the-canvas-element-2kk5</guid>
      <description>&lt;p&gt;For &lt;a href="https://hacktoberfest.digitalocean.com/" rel="noopener noreferrer"&gt;Hacktoberfest&lt;/a&gt; this year, I contributed to a &lt;a href="https://github.com/zero-to-mastery/Canvaz" rel="noopener noreferrer"&gt;project&lt;/a&gt; using the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element. I was intrigued, as I'd come across it before while I was learning HTML but always thought "Eh, I'll get to that one day...".&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element?
&lt;/h2&gt;

&lt;p&gt;It's an HTML element that gives you the ability to draw with JavaScript. Pretty neat. It takes whatever &lt;code&gt;id&lt;/code&gt; and dimensions you'd like as attributes, and wraps around a backup image which only displays if your drawing doesn't load:&lt;br&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%2F8kj2ajxbqy1szqkle01l.png" 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%2F8kj2ajxbqy1szqkle01l.png" alt="The canvas element embedded in the body element"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to animate the moon
&lt;/h2&gt;

&lt;p&gt;You don't have to animate the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element but I thought it'd be a nice challenge. I decided to create a &lt;a href="https://gabriellend.github.io/moon-animation/" rel="noopener noreferrer"&gt;waxing and waning moon animation&lt;/a&gt;. &lt;strong&gt;My approach was to write a function for each phase and loop through them using &lt;code&gt;setTimeout()&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Lay the foundation
&lt;/h3&gt;

&lt;p&gt;Before anything else, &lt;strong&gt;every &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element must start with two things:&lt;/strong&gt;&lt;br&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%2F2rp6vqz6kkfaaammd6or.png" 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%2F2rp6vqz6kkfaaammd6or.png" alt="The code to initialize the canvas element"&gt;&lt;/a&gt;&lt;br&gt;
First, we select the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element in the HTML with its &lt;code&gt;id&lt;/code&gt; and save it in a variable. Second, we create a variable for the &lt;em&gt;context&lt;/em&gt;. This is what we actually draw on. Surprise! The &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element itself is really just a container. This context variable is what we will use in our functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Initialize
&lt;/h3&gt;

&lt;p&gt;I chose a crescent moon as my starting phase. I drew it with a function called &lt;code&gt;init()&lt;/code&gt; and added it as an attribute to the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element we saw before, so that it's called when the page loads.&lt;br&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%2Fo376xtyns2ge9g6jg1r8.png" 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%2Fo376xtyns2ge9g6jg1r8.png" alt="Shows the body element with the "&gt;&lt;/a&gt;&lt;br&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%2Fve327qe6gfuve7fryr2a.png" 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%2Fve327qe6gfuve7fryr2a.png" alt="Shows the "&gt;&lt;/a&gt;&lt;br&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%2Fbe6f2s3xeeambr9vqynk.png" 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%2Fbe6f2s3xeeambr9vqynk.png" alt="Crescent moon phase with corresponding code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Repeat with slight variations
&lt;/h3&gt;

&lt;p&gt;I ended up with six very similar functions, so similar that I won't detail each of them here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;init()&lt;/li&gt;
&lt;li&gt;quarterMoon()&lt;/li&gt;
&lt;li&gt;halfMoon()&lt;/li&gt;
&lt;li&gt;fullMoon()&lt;/li&gt;
&lt;li&gt;halfMoonWane()&lt;/li&gt;
&lt;li&gt;quarterMoonWane()&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Each function calls the next one and &lt;code&gt;quarterMoonWane()&lt;/code&gt; calls &lt;code&gt;init()&lt;/code&gt;. That is how the continuous wax/wane effect is achieved.&lt;/strong&gt; The only differences are the inner(bezier) and outer(arc) curves of each phase. Really it's only four functions, as &lt;code&gt;quarterMoon()&lt;/code&gt; and &lt;code&gt;halfMoon()&lt;/code&gt; are basically equivalent to &lt;code&gt;quarterMoonWane()&lt;/code&gt; and &lt;code&gt;halfMoonWane()&lt;/code&gt;. I repeated them because during the waning phase I needed the same shapes but different &lt;code&gt;setTimeout()&lt;/code&gt; function calls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges and reflections
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element is no joke. I spent two days working out how to achieve this animation. Granted, it was my first try and I had to do a lot of research and trial and error with tricky math, but it's still a challenging element to work with. Even though I'm glad I got acquainted with it, I can't really think of a situation where I'd want to use it again.&lt;/p&gt;

&lt;p&gt;One of the hardest things about it is that &lt;strong&gt;you can't see your progress unless you call a method to connect the points you've established&lt;/strong&gt; (I used &lt;code&gt;ctx.fill()&lt;/code&gt; here, you can use &lt;code&gt;ctx.stroke()&lt;/code&gt; to draw a line instead). It was cumbersome doing that after every line and then deleting them all(except the last one) once I knew what was happening. It makes me wonder if there is an easier way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I also really wanted the transition between each stage to be a little smoother.&lt;/strong&gt; I tried speeding up the intervals on &lt;code&gt;setTimeout()&lt;/code&gt; but that didn't give me the effect I was hoping for. I also experimented with &lt;code&gt;window.requestAnimationFrame()&lt;/code&gt;, another method used with &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt;, but that made it way too fast by itself. I'm sure there is a way to make it work but I wasn't able to find it after much searching and experimenting. &lt;/p&gt;

&lt;p&gt;Finally, since there is a lot of repeated code here, I'm sure there is a more elegant way of achieving this type of animation but in the end it gets the job done and I'm a fan!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/html/html5_canvas.asp" rel="noopener noreferrer"&gt;Here's&lt;/a&gt; a resource for more info on the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element and, as always, &lt;a href="https://github.com/gabriellend/moon-animation" rel="noopener noreferrer"&gt;here's my code&lt;/a&gt; if you'd like to inspect in more detail.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>hacktoberfest</category>
      <category>html</category>
    </item>
    <item>
      <title>What does "origin master" mean?</title>
      <dc:creator>Gabrielle Davidson</dc:creator>
      <pubDate>Sun, 03 Oct 2021 05:57:22 +0000</pubDate>
      <link>https://dev.to/gabriellend/this-one-thing-helped-me-understand-git-commands-940</link>
      <guid>https://dev.to/gabriellend/this-one-thing-helped-me-understand-git-commands-940</guid>
      <description>&lt;p&gt;Git commands are a leading cause of hair loss for many beginner software engineers, and even for some more experienced ones as well. I've finally realized something that might've helped me when I was first starting out and hopefully will save you some headaches too.&lt;/p&gt;

&lt;h2&gt;
  
  
  "origin master" explained
&lt;/h2&gt;

&lt;p&gt;At some point in our development career we get real familiar with the classic &lt;code&gt;git push origin master&lt;/code&gt;*. What is this command actually saying though? "git push" is pretty clear, but what exactly is "origin master"? For the longest time I thought it meant:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;push from &lt;strong&gt;your computer&lt;/strong&gt; to &lt;strong&gt;GitHub&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I thought &lt;em&gt;origin&lt;/em&gt; was my computer, and &lt;em&gt;master&lt;/em&gt; was GitHub. To my brain, &lt;em&gt;origin&lt;/em&gt; was where the new code I wanted to push had &lt;em&gt;originated&lt;/em&gt; (my computer, because that's where I wrote it) and &lt;em&gt;master&lt;/em&gt; was where I wanted it to go. Not so far fetched. I was right that they are two separate entities, but I was wrong about &lt;em&gt;which&lt;/em&gt; two entities.&lt;/p&gt;

&lt;p&gt;Actually, &lt;em&gt;origin&lt;/em&gt; refers to the repository on GitHub (aka the "remote repository") where you originally cloned your code from, and &lt;em&gt;master&lt;/em&gt; is the branch in &lt;em&gt;origin&lt;/em&gt; that you want to push your changes to. &lt;em&gt;They both refer to what's on GitHub&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;This cleared up so much for me. Suddenly, in a cascade of insight, other git commands started to make more sense too. It does get more complicated, but hopefully this simple shift in understanding is a stepping stone that will help you have a breakthrough of your own on your way to becoming a git ninja. &lt;/p&gt;

&lt;p&gt;*Note: GitHub has changed "master" to "main" so, increasingly, the command will be &lt;code&gt;git push origin main&lt;/code&gt;. Older repos will sometimes still use "master". Good to be aware of both. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>github</category>
    </item>
    <item>
      <title>How to make your to-do list editable with basic JavaScript </title>
      <dc:creator>Gabrielle Davidson</dc:creator>
      <pubDate>Sat, 25 Sep 2021 21:44:37 +0000</pubDate>
      <link>https://dev.to/gabriellend/how-to-make-your-to-do-list-editable-with-javascript-5119</link>
      <guid>https://dev.to/gabriellend/how-to-make-your-to-do-list-editable-with-javascript-5119</guid>
      <description>&lt;p&gt;A to-do list is one of the first projects many developers create. The basic components are a way to add items and a way to delete them. This article is for those who have already implemented these basics and want to add the extra feature of being able to edit items once they are added.&lt;/p&gt;

&lt;p&gt;Experiment with my to-do list &lt;a href="https://gabriellend.github.io/shopping-list/" rel="noopener noreferrer"&gt;here&lt;/a&gt; and if you'd like to inspect the code, you can find it on GitHub &lt;a href="https://github.com/gabriellend/shopping-list.git" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Note: it is only optimized for laptops at this time.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to edit items
&lt;/h2&gt;

&lt;p&gt;I wanted to be able to double click an item on the list in order to change it. Maybe I misspelled it or something. In my HTML, I used list elements for items. The high level idea was to temporarily replace the list element with an input element, type in something new, then change it back to a list element. To achieve this, &lt;strong&gt;I first added an event listener to each item when it was created&lt;/strong&gt;:&lt;br&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%2F7etazdwzgecu514of388.png" 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%2F7etazdwzgecu514of388.png" alt="Code to add an event listener to each item"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Next, I created the &lt;code&gt;editItem&lt;/code&gt; function&lt;/strong&gt;. The list item you want to change is replaced by an input element with the same value. Then you are able to edit that value. These are the inner workings:&lt;br&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%2F5xn86uuwr8lz57j1fo1c.png" 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%2F5xn86uuwr8lz57j1fo1c.png" alt="Steps for the 'editItem' function"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;The final step was to create the &lt;code&gt;saveItem&lt;/code&gt; function&lt;/strong&gt; in order to make my changes permanent. This basically reverses the steps above, replacing the input element and its new value with a new list element, though this time permanently (until you double click again, that is). Here's what it looks like:&lt;br&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%2Fms5c7ahmos6mljitgrqm.png" 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%2Fms5c7ahmos6mljitgrqm.png" alt="Steps for the 'saveItem' function"&gt;&lt;/a&gt;&lt;br&gt;
 That's it! If you happen to inspect it on GitHub, you may notice some slight variations in the code but none are relevant to making items editable. I hope this helps you make all your editable-to-do-list-dreams come true!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>html</category>
      <category>css</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
