<?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: Sam-Wisdoms  Amenyenu</title>
    <description>The latest articles on DEV Community by Sam-Wisdoms  Amenyenu (@samwisdomsamenyenu).</description>
    <link>https://dev.to/samwisdomsamenyenu</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%2F1169974%2F763c7417-07cc-4ec3-87c6-62b0f07ad09f.jpg</url>
      <title>DEV Community: Sam-Wisdoms  Amenyenu</title>
      <link>https://dev.to/samwisdomsamenyenu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samwisdomsamenyenu"/>
    <language>en</language>
    <item>
      <title>The Difference Between textContent, innerText and innerHTML in JavaScript</title>
      <dc:creator>Sam-Wisdoms  Amenyenu</dc:creator>
      <pubDate>Wed, 13 Dec 2023 14:00:35 +0000</pubDate>
      <link>https://dev.to/samwisdomsamenyenu/the-difference-between-textcontent-innertext-and-innerhtml-in-javascript-2dfj</link>
      <guid>https://dev.to/samwisdomsamenyenu/the-difference-between-textcontent-innertext-and-innerhtml-in-javascript-2dfj</guid>
      <description>&lt;p&gt;In JavaScript Document Object Model(DOM) manipulation, we can use the &lt;code&gt;textContent&lt;/code&gt;&lt;br&gt;
, &lt;code&gt;innerText&lt;/code&gt;, and &lt;code&gt;innerHTML&lt;/code&gt; properties to read the text, and we can also use them to update/set the text of an element.&lt;/p&gt;

&lt;p&gt;In this blog post, you will learn about how these properties are used to read and update the text of an HTML element.&lt;/p&gt;

&lt;p&gt;Let's start!&lt;/p&gt;
&lt;h2&gt;
  
  
  What is &lt;code&gt;textContext&lt;/code&gt; property in JavaScript DOM manipulation
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;textContent&lt;/code&gt; is a JavaScript DOM property that displays only the text inside of an HTML tag. Thus, it ignores all HTML tags and returns only the text inside the tags.&lt;/p&gt;

&lt;p&gt;Let's see an example using the below HTML markup;&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;id=&lt;/span&gt;&lt;span class="s"&gt;"mylinks"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        This is my &lt;span class="nt"&gt;&amp;lt;b&amp;gt;&lt;/span&gt;text content&lt;span class="nt"&gt;&amp;lt;/b&amp;gt;&lt;/span&gt;:
        &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"www.sam.com"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hello &lt;span class="nt"&gt;&amp;lt;b&amp;gt;&lt;/span&gt;friend&lt;span class="nt"&gt;&amp;lt;/b&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"www.myblogs.com"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Welcome to my &lt;span class="nt"&gt;&amp;lt;b&amp;gt;&lt;/span&gt;blogs page&lt;span class="nt"&gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/ul&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;Using the &lt;code&gt;textContent&lt;/code&gt; property, let's see what the &lt;code&gt;textContent&lt;/code&gt; property will print to the console when we apply it to the above HTML markup.&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;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mylinks&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="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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below is what the &lt;code&gt;textContent&lt;/code&gt; property will print to the console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; This is my text content:

          Hello friend 
          Welcome to my blog page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let us see another example with the &lt;code&gt;textContent&lt;/code&gt; property.&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;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="s1"&gt;inner&lt;/span&gt;&lt;span class="dl"&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;button&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="s1"&gt;btn&lt;/span&gt;&lt;span class="dl"&gt;'&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;here&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's apply textContent on the above HTML markup.&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;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;inner&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="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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below is what the &lt;code&gt;textContent&lt;/code&gt; property for the above HTML markup will print to the console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     Click here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thus, &lt;code&gt;textContent&lt;/code&gt; will return the texts inside the targeted element. It is important to note, however, that the &lt;code&gt;textContent&lt;/code&gt; property does not take into account CSS properties and style applied to an element.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to set the text of an HTML element using &lt;code&gt;textContent&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Let's see how we can use &lt;code&gt;textContent&lt;/code&gt; to set the text of the below HTML markup.&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;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="s1"&gt;outer&lt;/span&gt;&lt;span class="dl"&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;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="s1"&gt;inner&lt;/span&gt;&lt;span class="dl"&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;button&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="s1"&gt;btn&lt;/span&gt;&lt;span class="dl"&gt;'&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;here&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&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="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;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;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;inner&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="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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Click here&lt;/span&gt;

&lt;span class="nx"&gt;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Submit me instead!&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Submit me instead!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is the &lt;code&gt;innerText&lt;/code&gt; property in JavaScript?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;innerText&lt;/code&gt; property takes into account "human-readable" elements. This property behaves like the &lt;code&gt;textContent&lt;/code&gt; property except that the &lt;code&gt;innerText&lt;/code&gt; property takes into account CSS properties and styling and won't return any text of "hidden" elements.&lt;/p&gt;

&lt;p&gt;Let's see an example with the &lt;code&gt;innerText&lt;/code&gt; property using the HTML markup below.&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;div&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;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;First&lt;/span&gt; &lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&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="nx"&gt;h3&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="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&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="nx"&gt;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Third&lt;/span&gt; &lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&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="nx"&gt;h3&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;display: none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;**&lt;/span&gt;&lt;span class="nx"&gt;Fourth&lt;/span&gt; &lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&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;/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;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerText&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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;innerText&lt;/code&gt; property for the above HTML markup will print to the console the below text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;First display
Second display
Third display
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;NB:&lt;/em&gt; &lt;br&gt;
When you apply the &lt;code&gt;textContent&lt;/code&gt; property on the same HTML markup above, it will also display the texts inside the last &lt;/p&gt;
&lt;h3&gt; tag with the style of display set to none because the &lt;code&gt;textContent&lt;/code&gt; unlike the &lt;code&gt;innerText&lt;/code&gt; property does not take into account "hidden" elements. 

&lt;/h3&gt;
&lt;p&gt;Try it out and see the result for yourself!&lt;/p&gt;
&lt;h2&gt;
  
  
  How to set the text of an HTML element using &lt;code&gt;innerText&lt;/code&gt;.
&lt;/h2&gt;

&lt;p&gt;Let's see how we can use &lt;code&gt;innerText&lt;/code&gt; to set the text of the below HTML markup.&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;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="s1"&gt;inner&lt;/span&gt;&lt;span class="dl"&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;button&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="s1"&gt;btn&lt;/span&gt;&lt;span class="dl"&gt;'&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;here&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&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;/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;let&lt;/span&gt; &lt;span class="nx"&gt;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;inner&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerText&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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Click here&lt;/span&gt;

&lt;span class="nx"&gt;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Submit me instead!&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Submit me instead!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is &lt;code&gt;innerHTML&lt;/code&gt; property in JavaScript DOM manipulation?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;innerHTML&lt;/code&gt; just as textContent and innerText can also be used to read or update HTML elements.&lt;/p&gt;

&lt;p&gt;To insert the HTML into a document rather than replace the contents of an element, use the method &lt;code&gt;insertAdjacentHTML()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; &lt;code&gt;innerHTML&lt;/code&gt; will return the texts inside an HTML element together with their respective tags.&lt;/p&gt;

&lt;p&gt;Using the HTML markup example below, we will see what the &lt;code&gt;innerHTML&lt;/code&gt; property will return inside the console.&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;div&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;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;First&lt;/span&gt; &lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&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="nx"&gt;h3&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="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&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="nx"&gt;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Third&lt;/span&gt; &lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&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="nx"&gt;h3&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;display: none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Fourth&lt;/span&gt; &lt;span class="nx"&gt;display&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h3&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's see what the above HTML markup will return when we use &lt;code&gt;innerHTML&lt;/code&gt; on it.&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;divEl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&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="nx"&gt;divEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below is what will be printed in the console as we apply &lt;code&gt;innerHTML&lt;/code&gt; property to the code above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;h1&amp;gt;First display&amp;lt;/h1&amp;gt;
      &amp;lt;h3&amp;gt;Second display&amp;lt;/h3&amp;gt;
      &amp;lt;h3&amp;gt;Third display&amp;lt;/h3&amp;gt;
      &amp;lt;h3 style="display: none"&amp;gt;Fourth display&amp;lt;/h3&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thus, &lt;code&gt;innerHTML&lt;/code&gt; will return all the texts of an element and their respective tags. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
In this blog article, we have seen that the three ways by which we can read or update the text of an HTML element are;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;textContent&lt;/code&gt; is a JavaScript DOM property that displays only the text inside of an HTML tag. It does not take into account CSS properties and styling. It will return the text of hidden elements or elements with display set to none.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;innerText&lt;/code&gt; property behaves like the &lt;code&gt;textContent&lt;/code&gt; property except that the &lt;code&gt;innerText&lt;/code&gt; property takes into account CSS properties and styling and will not return any text of "hidden" elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;innerHTML&lt;/code&gt; just as &lt;code&gt;textContent&lt;/code&gt; and &lt;code&gt;innerText&lt;/code&gt; can also be used to read or update HTML elements.&lt;br&gt;
&lt;code&gt;innerHTML&lt;/code&gt; will return the texts inside an HTML element together with their respective tags.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;If you enjoy this blog post, please don't forget to like, comment and share.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To read more, check &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent"&gt;MDN&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.freecodecamp.org/news/innerhtml-vs-innertext-vs-textcontent/"&gt;freeCodeCamp&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3schools.com/jsref/prop_node_innertext.asp"&gt;w3schools&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Convert a String to a Number in JavaScript</title>
      <dc:creator>Sam-Wisdoms  Amenyenu</dc:creator>
      <pubDate>Wed, 29 Nov 2023 01:34:52 +0000</pubDate>
      <link>https://dev.to/samwisdomsamenyenu/how-to-convert-a-string-to-a-number-in-javascript-3dfc</link>
      <guid>https://dev.to/samwisdomsamenyenu/how-to-convert-a-string-to-a-number-in-javascript-3dfc</guid>
      <description>&lt;p&gt;When it comes to converting string to number in JavaScript, there are many ways by which you can achieve that.&lt;br&gt;
In this article, we are going to explore; five(5) ways by which you can convert a string to a number in JavaScript.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to convert a string to a number using the plus (+) operator.
&lt;/h2&gt;

&lt;p&gt;One of the ways by which you can convert a string into a number in JavaScript is by using the &lt;strong&gt;unary plus (+) operator&lt;/strong&gt; or simply by using the plus symbol.&lt;/p&gt;

&lt;p&gt;Let's see an example of how this looks like in code.&lt;/p&gt;

&lt;p&gt;In this example, we are using the &lt;strong&gt;let&lt;/strong&gt; keyword to declare a variable called &lt;strong&gt;stringToNumber&lt;/strong&gt; with a value of "25" which is a string.&lt;/p&gt;

&lt;p&gt;Let's see how to convert the string "25" to a number,&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;stringToNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;// 25&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="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Assuming&lt;/strong&gt; you have a &lt;strong&gt;variable&lt;/strong&gt; called &lt;strong&gt;word&lt;/strong&gt; set to a value of &lt;strong&gt;"I am a word"&lt;/strong&gt; which is a string as below;&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I am a word&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// I am a word&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="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Try&lt;/strong&gt; to convert the &lt;strong&gt;word&lt;/strong&gt; into a number, using the &lt;strong&gt;plus&lt;/strong&gt; &lt;em&gt;(+)&lt;/em&gt; &lt;strong&gt;operator&lt;/strong&gt; as below;&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I am a word&lt;/span&gt;&lt;span class="dl"&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="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;// NaN (Not a Number)&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="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Converting string to a number using the number() method or function.
&lt;/h2&gt;

&lt;p&gt;Let's see in code how this 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stringToNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25&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;From our earlier example, we know&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="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Now, when&lt;/strong&gt; we do&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="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Keep in mind&lt;/strong&gt; the &lt;strong&gt;Number()&lt;/strong&gt; is case sensitive so &lt;strong&gt;&lt;em&gt;Number()&lt;/em&gt;&lt;/strong&gt; is not the same as &lt;strong&gt;number()&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's see what will be printed to the console using the **Number()&lt;/strong&gt; method if it is a word using our &lt;strong&gt;let word = "I am a word"&lt;/strong&gt; variable declaration as above.&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I am a word&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// NaN just as in the case of the plus(+) operator above.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Try it yourself.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Converting a string to a number using the parseInt() function method.
&lt;/h2&gt;

&lt;p&gt;Another way of converting a string to a number is by using the &lt;strong&gt;parseInt() function&lt;/strong&gt;.&lt;br&gt;
Check it out in the code below using our stringToNumber example:&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;stringToNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 25.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;parseInt()&lt;/strong&gt; method using our &lt;strong&gt;word&lt;/strong&gt; example:&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I am a word&lt;/span&gt;&lt;span class="dl"&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;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="c1"&gt;// NaN.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note, however, that the parseInt() function can take in two arguments; the string you are passing in and an &lt;strong&gt;optional radix&lt;/strong&gt;.&lt;br&gt;
A &lt;strong&gt;radix&lt;/strong&gt; is a number between 2 and 36 which represents the base in a numeral system. For example, a radix of 2 would represent the binary system, while a radix of 10 represents the decimal system.&lt;/p&gt;
&lt;h2&gt;
  
  
  Converting a string to a number using the Math.floor() function
&lt;/h2&gt;

&lt;p&gt;Using the &lt;strong&gt;let stringToNumber = "25",&lt;/strong&gt; let's see the output of the Math.floor() method in 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stringToNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// number&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Math.floor() will return NaN using the let word = "I am a word" variable declaration.&lt;br&gt;
Check it below;&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I am a word&lt;/span&gt;&lt;span class="dl"&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Converting a string to a number using the Math.ceil() function
&lt;/h2&gt;

&lt;p&gt;The Math.ceil function can also be used to convert a string to a number by rounding the number to the nearest integer if the number is a decimal. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's see in code;&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;stringToNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25.7&lt;/span&gt;&lt;span class="dl"&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// 26 thus rounding the number to the nearest integer.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Another example to show something&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;stringToNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25.1&lt;/span&gt;&lt;span class="dl"&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// 26&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Math.ceil()&lt;/strong&gt; will return NaN with our *&lt;em&gt;word&lt;/em&gt; variable declaration.&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I am a word&lt;/span&gt;&lt;span class="dl"&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Thank you for reading.
&lt;/h2&gt;

&lt;p&gt;Please don't forget to comment, like, and &lt;a href="https://dev.to/samwisdomsamenyenu/how-to-convert-a-string-to-a-number-in-javascript-3dfc/edit"&gt;click here to share&lt;br&gt;
&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To read about other methods of converting a string to a number in JavaScript, please read from the &lt;a href="https://www.freecodecamp.org/news/how-to-convert-a-string-to-a-number-in-javascript/"&gt;freeCodeCamp website&lt;/a&gt;. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Difference Between an ID and a Class in HTML.</title>
      <dc:creator>Sam-Wisdoms  Amenyenu</dc:creator>
      <pubDate>Tue, 28 Nov 2023 14:21:44 +0000</pubDate>
      <link>https://dev.to/samwisdomsamenyenu/understanding-the-difference-between-an-id-and-a-class-in-html-he1</link>
      <guid>https://dev.to/samwisdomsamenyenu/understanding-the-difference-between-an-id-and-a-class-in-html-he1</guid>
      <description>&lt;p&gt;Every time, we make the decision to learn something new, we will be faced with difficulties of one kind or the other. Understanding the concept of what we want to learn is important.&lt;/p&gt;

&lt;p&gt;Today, we are going to learn about two of the commonly used concepts you will come across every day when you are a programmer or developer. That is the concept of ID and CLASS.&lt;/p&gt;

&lt;p&gt;An understanding of them is as, however, important as acquiring a passport if you wish to travel abroad.&lt;/p&gt;

&lt;p&gt;First of all, what is an ID? In plain English, ID stands for Identity Document. Everyone has some sort of Identity and can be identified as such. For example, if a person is tall among many others who are short, he can be described or identified as “the tall one” and the other members will know the very person that is been referred to so the height of that person can be used to identify him or her among the other members.&lt;/p&gt;

&lt;p&gt;Now, let’s drill it down further. When a person acquires a birth certificate, passport, residence card, National Insurance Number etcetera, these are all different types of identity documents as these documents can be used to specifically identify, trace, or point at them.&lt;/p&gt;

&lt;p&gt;No two persons will have exactly the same identities. In the identity documents analogy that is explained above, when two or more persons have exactly the same identity name, document number, date of birth, etc, it means something is wrong somewhere and needs to be rechecked and corrected.&lt;/p&gt;

&lt;p&gt;The same concept is what is at play in the world of programming. &lt;br&gt;
IDs are applied to an element when you don’t want them to change. That is if you don’t want an item to change or belong to the class of the masses, then the best thing you can do is to apply and ID to that item or element so that, you can use the ID name you have given to that element or item to identify them specifically out of 1 million and more other items. &lt;/p&gt;

&lt;p&gt;In the HTML document IDs are written as for example; ID = sam; whereas in the CSS, they are denoted with the # Symbol so the ID = sam above in the CSS will be written or targeted as #sam.&lt;/p&gt;

&lt;p&gt;Class on the other hand is loose. A class can be applied to many different elements or items using the same class name. From the identity document analogy, where two or more persons, cannot have the same identity document features exactly the same, classes don’t care. &lt;/p&gt;

&lt;p&gt;With Class, different people can have exactly the same features such as name, number, date of birth etcetera and everything will still be fine. &lt;/p&gt;

&lt;p&gt;In my own words, I will describe classes as being loose and flexible. They don’t care about specificity.&lt;/p&gt;

&lt;p&gt;If for example we have 4 people with the names; Sam, Ben, Fenya, and Mary and we want to target all of them as one, we can do so by putting them all together in a class and applying a common name on all of them. &lt;/p&gt;

&lt;p&gt;For instance, if we want to apply a class to the above name by giving them a common name, we can do so by giving them the same class name individually in the HTML document as class = name.&lt;br&gt;
In the CSS, classes are targeted by using the full-stop or dot (.) symbol.&lt;/p&gt;

&lt;p&gt;Take a look at an example of how class and ID are written in HTML when you are writing code.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     &amp;lt;div class="single-project" id="calculator"&amp;gt;&amp;lt;/div&amp;gt;   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Take a look at how the ID items or elements in the HTML are targeted in the CSS.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#calculator {&lt;br&gt;
  background-image: url(../images/02-portfolio-2.jpg);&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#led-wall {&lt;br&gt;
  background-image: url(../images/02-portfolio-1.jpg);&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Take a look at how the Class items or elements in the HTML are targeted in the CSS.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.single-project{&lt;br&gt;
  border-style: solid;&lt;br&gt;
  border-color: aquamarine;&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.project-container {&lt;br&gt;
  background-color: aqua;&lt;br&gt;
  align-items: flex-start;&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I believe this blog post helps you to get a better understanding of the concept of CLASS and ID in programming.&lt;br&gt;
If this blog post helps you, please like, share, and comment.&lt;br&gt;
Want to read more resources, read more from the &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors"&gt;Mozilla Developers Network&lt;/a&gt; site.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;NB:&lt;br&gt;
Are you looking for a good technical writer or someone for your website project? Contact me by email at: asamwisdoms@gmail.com.&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding the Difference Between an ID and a Class and How They are Used in Web Development.</title>
      <dc:creator>Sam-Wisdoms  Amenyenu</dc:creator>
      <pubDate>Tue, 21 Nov 2023 22:44:32 +0000</pubDate>
      <link>https://dev.to/samwisdomsamenyenu/understanding-the-difference-between-an-id-and-a-class-and-how-they-are-used-in-web-development-21l0</link>
      <guid>https://dev.to/samwisdomsamenyenu/understanding-the-difference-between-an-id-and-a-class-and-how-they-are-used-in-web-development-21l0</guid>
      <description>&lt;p&gt;Every time, we make the decision to learn something new, we will be faced with difficulties of one kind or the other. Although the difficulties we encounter sometimes when learning new things may seem simple when we see other people who are knowledgeable handle the same difficulties with ease, it is not always the case. &lt;br&gt;
There may be several underlying factors that can make learning something new difficult. The reason may simply be that things seem difficult just because we are just starting out and it is normal that we have difficulty understanding. &lt;br&gt;
What is helpful in navigating this stage if we have just started out is a lot of practice and over time, we will become experienced thus making those things that once seem difficult becoming easy. As the common saying goes, practice makes perfect. &lt;br&gt;
Sometimes too, the reason why learning something new can seem difficult can also be because, we lack understanding of the basic concepts that underly what we are learning so again, practice and trying to understand the basic concepts that underly what we are learning will be helpful.&lt;br&gt;
It is important to note, however, that every new thing you set out to learn needs time, consistency, and practice to break into understanding.&lt;br&gt;
Today, you are fully going to understand two of the commonly used concepts you will come across every day when you are a programmer or developer. That is the concept of ID and CLASS. In your career life as a programmer or developer, you cannot avoid coming across these two concepts on a daily basis. An understanding of them is as, however, important as acquiring a passport if you wish to travel abroad.&lt;br&gt;
First of all, what is an ID? In plain English, ID stands for Identity Document. Everyone has some sort of Identity and can be identified as such. For example, if a person is tall among many others who are short, he can be described or identified as “the tall one” and the other members will know the very person that is been referred to so the height of that person can be used to identify him or her among the other members.&lt;br&gt;
Now, let’s drill it down further. When a person acquires a birth certificate, passport, residence card, National Insurance Number etcetera, these are all different types of identity documents as these documents can be used to specifically identify, trace, or point at them.&lt;br&gt;
No two persons will have exactly the same identities. In the identity documents analogy that is explained above, when two or more persons have exactly the same identity name, document number, date of birth, etc, it means something is wrong somewhere and needs to be rechecked and corrected.&lt;/p&gt;

&lt;p&gt;The same concept is what is at play in the world of programming. &lt;br&gt;
IDs are applied to an element when you don’t want them to change. That is if you don’t want an item to change or belong to the class of the masses, then the best thing you can do is to apply an ID to that item or element so that, you can use the ID name you have given to that element or item to identify them specifically out of 1 million and more other items. &lt;br&gt;
In the HTML document IDs are written as for example; ID = sam; whereas in the CSS, they are denoted with the # Symbol so the ID = Sam above in the CSS will be written/targeted as #sam.&lt;br&gt;
Class on the other hand is loose. A class can be applied to many different elements or items using the same class name. From the identity document analogy, where two or more persons, cannot have the same identity document features exactly the same, classes don’t care. With Class, different people can have exactly the same features such as name, number, date of birth etcetera and everything will still be fine. In my own words, I will describe classes as being loose and flexible. They don’t care about specificity.&lt;br&gt;
If for example we have 4 people with the names; Sam, Ben, Fenya, and Mary and we want to target all of them as one, we can do so by putting them all together in a class and applying a common name on all of them. For instance, if we want to apply a class to the above name by giving them a common name, we can do so by giving them the same class name individually in the HTML document as class = name.&lt;br&gt;
In the CSS, classes are targeted by using the full-stop or dot (.) symbol.&lt;br&gt;
Take a look at an example of how class and ID are written in HTML when you are writing code.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        &amp;lt;h3&amp;gt;Led Wall&amp;lt;/h3&amp;gt;
        &amp;lt;p&amp;gt;Node/IOT&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;/div&amp;gt;   
    &amp;lt;div class="single-project" id="calculator"&amp;gt;
      &amp;lt;div class="project-container"&amp;gt;
        &amp;lt;h3&amp;gt;Calculator&amp;lt;/h3&amp;gt;
        &amp;lt;p&amp;gt;React/JavaScript/CSS&amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;   
    &amp;lt;div class="single-project" id="pastel-puzzle"&amp;gt;
      &amp;lt;div class="project-container"&amp;gt;
        &amp;lt;h3&amp;gt;Pastel Puzzle&amp;lt;/h3&amp;gt;
        &amp;lt;p&amp;gt;Mern Stack&amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Take a look at how the ID items or elements in the HTML are targeted in the CSS.&lt;/p&gt;

&lt;h1&gt;
  
  
  surf-report {
&lt;/h1&gt;

&lt;p&gt;background-image: URL(../images/02-portfolio-4.jpg);&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  calculator {
&lt;/h1&gt;

&lt;p&gt;background-image: url(../images/02-portfolio-2.jpg);&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  led-wall {
&lt;/h1&gt;

&lt;p&gt;background-image: url(../images/02-portfolio-1.jpg);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Take a look at how the Class items or elements in the HTML are targeted in the CSS.&lt;br&gt;
.single-project{&lt;br&gt;
  border-style: solid;&lt;br&gt;
  border-color: aquamarine;&lt;br&gt;
  padding-block: 100px;&lt;br&gt;
  width: 1500px;&lt;br&gt;
  bottom: 20px;&lt;br&gt;
  flex-basis: calc(50% - 1em);&lt;br&gt;
  margin: 0.5em;&lt;br&gt;
  align-items: flex-end;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;.project-container {&lt;br&gt;
  background-color: aqua;&lt;br&gt;
  width: 150px;&lt;br&gt;
  align-items: flex-start;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;I believe this blog post helps you to get a better understanding of the concept of CLASS and ID in programming.&lt;br&gt;
If this blog post helps you, please like, share, and comment.&lt;br&gt;
Want to read more resources, read them here. &lt;br&gt;
NB:&lt;br&gt;
Are you looking for a good technical writer or someone for your website project? Contact me by email at: &lt;a href="mailto:asamwisdoms@gmail.com"&gt;asamwisdoms@gmail.com&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Know the Git Flow Commands in Just Five (5) Minutes.</title>
      <dc:creator>Sam-Wisdoms  Amenyenu</dc:creator>
      <pubDate>Fri, 13 Oct 2023 04:26:32 +0000</pubDate>
      <link>https://dev.to/samwisdomsamenyenu/understanding-the-git-flow-commands-in-just-five-5-minutes-fmh</link>
      <guid>https://dev.to/samwisdomsamenyenu/understanding-the-git-flow-commands-in-just-five-5-minutes-fmh</guid>
      <description>&lt;p&gt;Run the following commands to achieve that but make sure you spend two (3) minutes and read the entire blog post for very important explanations and other information. We assume that we have a directory called champions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;cd champions (to be on the champions directory which is the directory you are pushing from) . &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git status (to confirm you are on the right directory you want to push from). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git add –A (to stage all your changes to be committed). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git commit –m “Add brief message to describe the push” (to commit your changes to GitHub). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git pull origin main (To check if your directory/branch is up to date). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git push origin champions (to push your changes to GitHub) &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;**If **you are new to programming, it is normal to feel overwhelmed by the many new terminologies and commands you must live with for the rest of your working life, especially if your goal is to become a software developer or a Software Engineer. &lt;/p&gt;

&lt;p&gt;I must say that if other people have mastered these terminologies and commands. You can master them too. &lt;/p&gt;




&lt;p&gt;It is a fact that everything you set out to do or learn for the first time can feel very challenging. One thing that is worth remembering when faced with challenges while learning a new skill is; “the people you view in the field as professionals and experts were once like you. They, also, once or twice felt intimidated when they were just starting out like you”. Go on then to encourage yourself and say to yourself; “if others have started it before me and went on to become experts/professionals, I can also start it, attach seriousness to it and one day, I will be viewed by those behind me as an expert/professional.  &lt;/p&gt;

&lt;p&gt;What is important is that instead of feeling constantly overwhelmed and stressed about the many information you had to comprehend in a field you are not familiar with, try to find strategies/techniques that can help you to adapt quickly into the new environment. &lt;/p&gt;

&lt;p&gt;The focus of this blog post is to help you understand the Git Flow process in just 5 minutes. &lt;/p&gt;

&lt;p&gt;The Git Flow process is the various processes / commands you run in the terminal when you are pushing a file from your local machine to GitHub.  &lt;/p&gt;

&lt;p&gt;Before you start to run your commands, make sure you are on the right directory from where you want to push to GitHub. &lt;/p&gt;

&lt;p&gt;You can check the directory you are on by running the cd command in your terminal. &lt;/p&gt;

&lt;p&gt;In this blog post, let us assume that we have a directory called champions and we want to push changes we have made in this directory on our local machine to GitHub.   &lt;/p&gt;

&lt;p&gt;To check if we are on the champions directory, we will run the command, cd champions. &lt;/p&gt;

&lt;p&gt;Next, run git status command in the terminal to confirm if you have successfully navigated to the champions directory with your first command. &lt;/p&gt;

&lt;p&gt;If you notice that you are on the champions directory it is now time to start pushing your changes to GitHub. &lt;/p&gt;

&lt;p&gt;Next type the command git add -A in the command line/terminal to stage your changes ready to commit. &lt;/p&gt;

&lt;p&gt;Next type the command git commit -m “champions” to commit your changes to the repository on GitHub. &lt;/p&gt;

&lt;p&gt;Next make sure your current branch is up to date before you proceed to open a pull request. Check this by typing the command git pull origin main in the command line. &lt;/p&gt;

&lt;p&gt;The output from the git pull origin main command should read; “Already up to date” which is a confirmation that your current branch is up to date. &lt;/p&gt;

&lt;p&gt;After you have confirmed that your current branch is up to date, it is now time to do the final step in the Git Flow process that will push your change to GitHub. &lt;/p&gt;

&lt;p&gt;To do that type the command git push origin champions. &lt;/p&gt;

&lt;p&gt;After this command, a pull request will be created on GitHub. Proceed to GitHub to complete the pull request.  &lt;/p&gt;

&lt;p&gt;NOTE: &lt;/p&gt;

&lt;p&gt;Now you must make sure that your GitHub is in sync with your local machine so run the following commands to achieve that and to return to the main directory of your local machine. &lt;/p&gt;

&lt;p&gt;git checkout main &lt;/p&gt;

&lt;p&gt;git pull origin main. &lt;/p&gt;

&lt;p&gt;USEFUL LINK&lt;br&gt;
&lt;a href="https://coding-boot-camp.github.io/full-stack/git/getting-started-with-git"&gt;https://coding-boot-camp.github.io/full-stack/git/getting-started-with-git&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The most important thing to know before you start the actual programming/coding if you are a beginner.</title>
      <dc:creator>Sam-Wisdoms  Amenyenu</dc:creator>
      <pubDate>Thu, 05 Oct 2023 22:03:00 +0000</pubDate>
      <link>https://dev.to/samwisdomsamenyenu/the-most-important-thing-to-know-before-you-start-the-actual-programmingcoding-if-you-are-a-beginner-59ie</link>
      <guid>https://dev.to/samwisdomsamenyenu/the-most-important-thing-to-know-before-you-start-the-actual-programmingcoding-if-you-are-a-beginner-59ie</guid>
      <description>&lt;p&gt;To many people, learning something new can feel both exciting and challenging. However, it is a fact that learning is not exciting to everyone. It can be more challenging than the excitements that come with it. From my own personal experience, there are various factors that can contribute to good learning experience and there are various factors that can contribute to bad/struggling learning experience.  &lt;/p&gt;

&lt;p&gt;When you are venturing into a new area of study such as programming, the challenges can even be more, especially if you don’t have any background prior.  &lt;/p&gt;

&lt;p&gt;To deviate a little bit into religion about what the Bible says about confronting challenges during periods of difficulty; declare “I can do all things through Christ who strengthens me. (Philippians 4:13) and believe in yourself that you will confront the challenges head on, you will win, and you shall find the excitement that you wish to achieve in the end. &lt;/p&gt;

&lt;p&gt;Every win comes with having a good strategy in place. Before you start to write codes as a beginner the number one question from my point of view which I believe you should ask yourself is which code editor will I feel more comfortable using to write my codes? Which other code editors are there that I can comfortably use or learn to use very quickly. &lt;/p&gt;

&lt;p&gt;In this blog post, we are going to explore three (3) code editors that you can consider using as a beginner when starting to learn programming. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=B-s71n0dHUk"&gt;Visual Studio Code &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Visual Studio Code is a lightweight, but powerful opensource code editor developed by Microsoft. The name is common among developers as it is a code editor that is easy to use and it is used by millions of developers world-wide.  &lt;/p&gt;

&lt;p&gt;Visual Studio code has a lot of customization features that make it user friendly and appealing for users. &lt;/p&gt;

&lt;p&gt;Visual Studio code has a powerful &lt;a href="https://code.visualstudio.com/docs/editor/intellisense"&gt;IntelliSense&lt;/a&gt;; a feature that helps you to write code faster and accurately. VS Code have support for almost every major programming language. For example, JavaScript, C++, Python, TypeScript, CSS, and HTML are all supported. More rich language extensions can be found in the VS Code Marketplace. &lt;/p&gt;

&lt;p&gt;If you are looking for a code editor that is easy to use, more customizable, is open source and most importantly with a lot of resources easily available to lay your hands on, then I will highly recommend VS Code. &lt;/p&gt;

&lt;p&gt;Click &lt;a href="https://code.visualstudio.com/Download"&gt;here &lt;/a&gt;to Download VSCode that is compatible with your operating system for free from the VSCode website. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=RwwVthReQq0"&gt;ATOM&lt;/a&gt;&lt;br&gt;
Atom is a text editor that supports collaboration among developers thereby allowing for cross platform editing so developers can also collaborate across different operating systems. Developers can code together using the &lt;a href="https://github.blog/2022-06-08-sunsetting-atom/"&gt;Teletype&lt;/a&gt; tool which is available in beta form. &lt;/p&gt;

&lt;p&gt;The programming languages that are supported by Atom are C, C++, COBOL, HTML, CSS, Java, PHP, Ruby, Scala, and SQL. &lt;/p&gt;

&lt;p&gt;The operating systems that this code editor support include Windows, macOS, and Linux. It is a free code editor so if you are looking for a code editor which offers a lot of features for ease of collaboration on projects, then Atom may be the right choice for you. &lt;/p&gt;

&lt;p&gt;Click &lt;a href="https://github.blog/2022-06-08-sunsetting-atom/"&gt;here &lt;/a&gt;to Download Atom for free from their website.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sublimetext.com/"&gt;Sublime Text &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sublime Text editor is a code editor that encompasses complete &lt;a href="https://www.hostinger.co.uk/tutorials/development-environment"&gt;development environment&lt;/a&gt; as it groups code, markup, and prose in a single tool. C++, Python, PHP, Rails, are some of the languages supported by this code editor. &lt;/p&gt;

&lt;p&gt;This code editor is made to handle large projects and heavy coding. For instance, it can open a 7 MB source code file and scroll through 200,000 lines of code seamlessly. Sublime Text lets users to also quickly jump between files and functions using the &lt;a href="https://docs.sublimetext.io/guide/usage/file-management/navigation.html#goto-anything"&gt;go to&lt;/a&gt; feature. &lt;/p&gt;

&lt;p&gt;Download sublime Text &lt;a href="https://www.sublimetext.com/"&gt;here&lt;/a&gt; which of course is not for free.  &lt;/p&gt;

&lt;p&gt;Please note that there are other types of code editors, and I will encourage you as a beginner to research the different code editors and their features so that you can decide on which one is best and more suitable for you to use.  &lt;/p&gt;

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