<?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: Mahabubur Rahman</title>
    <description>The latest articles on DEV Community by Mahabubur Rahman (@microrony).</description>
    <link>https://dev.to/microrony</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%2F446442%2F0ffdcb07-19a7-479b-9ade-c4dce7bdfa1a.jpg</url>
      <title>DEV Community: Mahabubur Rahman</title>
      <link>https://dev.to/microrony</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/microrony"/>
    <language>en</language>
    <item>
      <title>Difference Between classList and className</title>
      <dc:creator>Mahabubur Rahman</dc:creator>
      <pubDate>Sun, 06 Dec 2020 10:26:15 +0000</pubDate>
      <link>https://dev.to/microrony/difference-between-classlist-and-classname-45j7</link>
      <guid>https://dev.to/microrony/difference-between-classlist-and-classname-45j7</guid>
      <description>&lt;p&gt;We use classList and className on JavaScript DOM to manipulate classes from the element. These two DOM property has different use cases. Let's see what is the main difference between them.&lt;/p&gt;

&lt;h2&gt;
  
  
  classList
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Using &lt;code&gt;classList&lt;/code&gt;, you can add or remove a class without affecting any other classes the element may have.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So this is helpful for adding additional classes to an element that contain other classes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;classList&lt;/code&gt; has some handy methods like &lt;code&gt;toggle&lt;/code&gt; and &lt;code&gt;replace&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (clicked) {
    button.classList.add('clicked');
} else {
    button.classList.remove('clicked');
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here if the button was clicked it will add the &lt;strong&gt;clicked&lt;/strong&gt; class along with other classes the element may have and it will remove only the &lt;strong&gt;clicked&lt;/strong&gt; class from the element.&lt;/p&gt;

&lt;h2&gt;
  
  
  className
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you use &lt;code&gt;className&lt;/code&gt;, it will wipe out any existing classes while adding the new one (or if you assign an empty string it will wipe out all of them).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using &lt;code&gt;className&lt;/code&gt; can be a convenience when you know this element will not use any other classes.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (clicked) {
    button.className = 'clicked';
} else {
    button.className = '';
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, &lt;code&gt;className&lt;/code&gt; will wipe all the classes the element may have and add &lt;strong&gt;clicked&lt;/strong&gt; class to it. The empty string('') will wipe all the classes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;My recommendation would be to use &lt;code&gt;className&lt;/code&gt; whenever possible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;classList&lt;/code&gt; when you need classList methods like toggle, replace, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>html</category>
      <category>classlist</category>
      <category>classname</category>
    </item>
    <item>
      <title>Shortcuts For Command-Line Ninjas</title>
      <dc:creator>Mahabubur Rahman</dc:creator>
      <pubDate>Sat, 05 Dec 2020 12:55:06 +0000</pubDate>
      <link>https://dev.to/microrony/shortcuts-for-command-line-ninjas-1clp</link>
      <guid>https://dev.to/microrony/shortcuts-for-command-line-ninjas-1clp</guid>
      <description>&lt;p&gt;Nowadays, I spend more time in the Terminal. I'm learning some useful shortcuts to get things done faster. Here are some of those shortcuts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Navigation
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Ctrl + a&lt;/code&gt; =&amp;gt; Go to the beginning of a line.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Ctrl + e&lt;/code&gt; =&amp;gt; Go to the end of a line.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Alt + b&lt;/code&gt; =&amp;gt; Move backward one word.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Alt + f&lt;/code&gt; =&amp;gt; Move forward one word.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Cutting &amp;amp; Pasting
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Ctrl + k&lt;/code&gt; =&amp;gt; Delete all after the cursor.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Ctrl + u&lt;/code&gt; =&amp;gt; Delete all before the cursor.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Ctrl + w&lt;/code&gt; =&amp;gt; Delete one word before the cursor.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Ctrl + y&lt;/code&gt; =&amp;gt; Paste deleted caracters.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(tips: use Alt + b to move anywhere you want and use Ctrl + k to delete all words after the cursor.)&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Others
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;!!&lt;/code&gt; =&amp;gt; Repeats the last command.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Ctrl + h&lt;/code&gt; =&amp;gt; If you don't want to use the BACKSPACE key.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Ctrl + j&lt;/code&gt; =&amp;gt; If you don't want to use the ENTER/RETURN key.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Alt + u&lt;/code&gt; =&amp;gt; Capitalize all characters in a word after the cursor.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Alt + l&lt;/code&gt; =&amp;gt; Uncaptalize all characters in a word after the cursor.&lt;br&gt;&lt;br&gt;
&lt;code&gt;Ctrl + l&lt;/code&gt; =&amp;gt; Clears the screen and redisplay the line.&lt;br&gt;&lt;br&gt;
&lt;code&gt;history&lt;/code&gt; =&amp;gt; To see the past command you used. To use those command type ! before the command number.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(tips: use Alt + b and Alt + u to Capitalize a word before the cursor. The same goes for Alt + l)&lt;/strong&gt;&lt;/p&gt;

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