<?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: murloc-craft</title>
    <description>The latest articles on DEV Community by murloc-craft (@murloc-craft).</description>
    <link>https://dev.to/murloc-craft</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%2F1113046%2F6d0666ea-f215-4d07-881a-b4ba9e8608d1.jpg</url>
      <title>DEV Community: murloc-craft</title>
      <link>https://dev.to/murloc-craft</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/murloc-craft"/>
    <language>en</language>
    <item>
      <title>{Day1} function</title>
      <dc:creator>murloc-craft</dc:creator>
      <pubDate>Tue, 04 Jul 2023 18:35:00 +0000</pubDate>
      <link>https://dev.to/murloc-craft/day1-function-4onk</link>
      <guid>https://dev.to/murloc-craft/day1-function-4onk</guid>
      <description>&lt;p&gt;Dear Dev,&lt;/p&gt;

&lt;p&gt;Today I learned about functions in JavaScript. It's still a bit confusing, but I'll try to explain what I understood.&lt;/p&gt;

&lt;p&gt;In JavaScript, a function is a block of code that performs a specific task.&lt;/p&gt;

&lt;p&gt;It can be reused multiple times throughout a program.&lt;/p&gt;

&lt;p&gt;Functions are defined using the function keyword followed by a name and a set of parentheses.&lt;/p&gt;

&lt;p&gt;Any parameters that the function requires are listed inside the parentheses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;I tried to build a calculator!&lt;/em&gt;&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;let&lt;/span&gt; &lt;span class="nx"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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;Choose a first number&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;num1-el&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;num1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I started by creating a variable num1, assigned a prompt with the question 'Choose a first number,' and then converted the var num1 to a number.&lt;br&gt;
Then came the discovery of document.getElementById!&lt;br&gt;
Wow, I was so excited to learn how to communicate with the DOM!&lt;/p&gt;

&lt;p&gt;So, I assigned the content of num1 to the element #num1-el.&lt;/p&gt;

&lt;p&gt;Then I did the same thing for the var num2.&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;let&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&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;Choose a second number&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;num2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;num2-el&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is html for num1 and num2&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;span&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"num1-el"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;0&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"num2-el"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;0&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, I created buttons in my HTML for addition, subtraction, division, and multiplication.&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;"box-btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"add()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Add&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"subtract()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Subtract&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"divide()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Divide&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"multiply()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Multiply&lt;span class="nt"&gt;&amp;lt;/button&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;p&gt;I have already inserted the name of my function in the onclick.&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="nx"&gt;add&lt;/span&gt;&lt;span class="p"&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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;sumEl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; + &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; = &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;result&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;It was so simple! I remember during my lessons, I used to wonder, 'What is the real purpose of a function?'&lt;br&gt;
I didn't understand... &lt;br&gt;
But now, with this simple project, I am finally starting to understand the importance of functions&lt;/p&gt;




&lt;p&gt;I finally understood how DOM elements communicate with my JavaScript script.&lt;/p&gt;

&lt;p&gt;I can finally see the light at the end of the tunnel!&lt;/p&gt;

&lt;p&gt;So, I'm going to improve my code and build simple little projects, like a quote generator! Because I can see in my mind how it's possible to do it :)&lt;/p&gt;

&lt;p&gt;And all of this thanks to the resources available online on the internet!&lt;/p&gt;

&lt;p&gt;There are plenty of courses, videos, tutorials accessible for free or at a cost.&lt;br&gt;
But yes, if we have motivation, anything is possible :)&lt;/p&gt;

&lt;p&gt;I feel a little embarrassed to show my project (but I'll still share the link :p) because it's a 'newbie project,' but one day I will be capable of creating beautiful projects in JavaScript&lt;/p&gt;

&lt;p&gt;My Calculator:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Lysdora/TurtleCalc-Express"&gt;https://github.com/Lysdora/TurtleCalc-Express&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm also going to write a fiction story featuring a World of Warcraft hero and functions, similar to this story (my first story) :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://murloc-craft.medium.com/murloc-the-noob-vs-the-variable-f2506812a0cf"&gt;https://murloc-craft.medium.com/murloc-the-noob-vs-the-variable-f2506812a0cf&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>My JavaScript journal</title>
      <dc:creator>murloc-craft</dc:creator>
      <pubDate>Tue, 04 Jul 2023 07:29:48 +0000</pubDate>
      <link>https://dev.to/murloc-craft/my-javascript-journal-44g8</link>
      <guid>https://dev.to/murloc-craft/my-javascript-journal-44g8</guid>
      <description>&lt;p&gt;I am a beginner in learning JavaScript, oh my goodness, it can be so difficult some days!&lt;/p&gt;

&lt;p&gt;I will keep a journal to track my progress and development.&lt;/p&gt;

&lt;p&gt;That will help me stay motivated and not lose hope.&lt;br&gt;
I've realized that JavaScript is completely different from learning CSS and HTML.&lt;/p&gt;

&lt;p&gt;I spent several weeks trying to understand CSS flexbox and CSS grid, and now I've encountered an even more challenging beast: the realm of JavaScript.&lt;/p&gt;

&lt;p&gt;This journal will be written in a somewhat fictionalized manner :) I love video games, especially World of Warcraft! I've been playing it for 18 years now (oh my goodness... time flies).&lt;/p&gt;

&lt;p&gt;I can indeed help myself by explaining the workings of JavaScript, as when I explain what I have just learned, it further enhances my understanding of its logic.&lt;/p&gt;

&lt;p&gt;It allows me to solidify my knowledge by articulating concepts and processes in my own words.&lt;br&gt;
Additionally, writing about JavaScript can serve as a reference for my future learning and troubleshooting.&lt;/p&gt;

&lt;p&gt;So I should go ahead and document my journey in my journal—it will not only aid my understanding but also serve as a valuable resource for my continued growth in JavaScript.&lt;/p&gt;

&lt;p&gt;In this journal, we will follow the adventures of Murloc the Noob, Sylvanas the Huntress, Arthas the valiant Paladin, Onyxia the Dragon, and other adorable characters from World of Warcraft.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>worldofwarcraft</category>
      <category>gaming</category>
    </item>
  </channel>
</rss>
