<?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: Midhul P</title>
    <description>The latest articles on DEV Community by Midhul P (@midhul).</description>
    <link>https://dev.to/midhul</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%2F1738408%2Fc911f7e5-e158-4185-a055-49b6949f9db4.jpg</url>
      <title>DEV Community: Midhul P</title>
      <link>https://dev.to/midhul</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/midhul"/>
    <language>en</language>
    <item>
      <title>I just built an interactive Git playground to practice Git commands in your browser</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Mon, 30 Mar 2026 11:34:47 +0000</pubDate>
      <link>https://dev.to/midhul/i-just-built-an-interactive-git-playground-to-practice-git-commands-in-your-browser-1m</link>
      <guid>https://dev.to/midhul/i-just-built-an-interactive-git-playground-to-practice-git-commands-in-your-browser-1m</guid>
      <description>&lt;p&gt;I just built an interactive Git playground to practice real Git commands right in your browser — no setup, just hands-on learning.&lt;/p&gt;

&lt;p&gt;It’s task-based, visual, and built for developers who prefer learning by doing.&lt;/p&gt;

&lt;h2&gt;
  
  
  👉 &lt;a href="https://developwithmi.com/labs/git/" rel="noopener noreferrer"&gt; https://developwithmi.com/labs/git/&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;I’ve used Git for years, but I still find myself pausing sometimes:&lt;/p&gt;

&lt;p&gt;“Wait… what does this command actually do again?”&lt;/p&gt;

&lt;p&gt;Not because Git is too hard — but because most of us learned it passively.&lt;/p&gt;

&lt;p&gt;We watched tutorials.&lt;br&gt;
We followed along.&lt;br&gt;
But we didn’t really &lt;em&gt;use&lt;/em&gt; it enough to feel confident.&lt;/p&gt;




&lt;p&gt;So I built something simple.&lt;/p&gt;

&lt;p&gt;Instead of explanations, you get small tasks.&lt;/p&gt;

&lt;p&gt;You type real commands into a terminal-like interface, and the repository updates instantly. There’s also a visual graph, so you can actually see what’s happening as you go.&lt;/p&gt;

&lt;p&gt;No theory overload. Just practice.&lt;/p&gt;




&lt;p&gt;You’ll naturally go through things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;initializing a repo&lt;/li&gt;
&lt;li&gt;committing changes&lt;/li&gt;
&lt;li&gt;working with branches&lt;/li&gt;
&lt;li&gt;inspecting differences&lt;/li&gt;
&lt;li&gt;fixing mistakes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not as a course, but as a series of small, practical steps.&lt;/p&gt;




&lt;p&gt;This is still early, and I’m improving it as I go.&lt;/p&gt;

&lt;p&gt;If you try it and have suggestions — or if something feels confusing — I’d really like to hear that.&lt;/p&gt;

&lt;p&gt;And if you find any bugs, please let me know as well.&lt;/p&gt;




&lt;p&gt;If you’re trying to get more comfortable with Git, this might help.&lt;/p&gt;

&lt;p&gt;Or at least save you a few Google searches 🙂&lt;br&gt;
&lt;a href="https://developwithmi.com/labs/git/" rel="noopener noreferrer"&gt;https://developwithmi.com/labs/git/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>softwaredevelopment</category>
      <category>programming</category>
      <category>resources</category>
    </item>
    <item>
      <title>Angular Back Button Made Easy with ngx-navigate-back</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Mon, 24 Feb 2025 05:34:50 +0000</pubDate>
      <link>https://dev.to/midhul/angular-back-button-made-easy-with-ngx-navigate-back-75e</link>
      <guid>https://dev.to/midhul/angular-back-button-made-easy-with-ngx-navigate-back-75e</guid>
      <description>&lt;p&gt;While browsers provide a native back button, managing navigation history within Angular applications can be tricky, &lt;strong&gt;ngx-navigate-back&lt;/strong&gt; simplifies this by providing a lightweight solution to track navigation history and implement a “back” functionality — just like the browser’s back button, but within your Angular app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fp0hfehprzz550ru4db71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fp0hfehprzz550ru4db71.png" alt="did you know! 70% users expect a functional back button" width="800" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is ngx-navigate-back?
&lt;/h2&gt;

&lt;p&gt;ngx-navigate-back is a librray which is easy to implement a “back” functionality in your Angular app, allowing users to return to the previous page seamlessly. Unlike traditional browser navigation, this library records navigation history within your app, giving you full control over the navigation experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use ngx-navigate-back?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Simple Integration&lt;/strong&gt; — Easily integrate into any Angular project.&lt;br&gt;
&lt;strong&gt;Navigation History Tracking&lt;/strong&gt; — Automatically records and retrieves navigation history.&lt;br&gt;
&lt;strong&gt;Seamless Back Navigation&lt;/strong&gt; — Navigate back with a single function call.&lt;br&gt;
&lt;strong&gt;Retrieve Last Visited URL&lt;/strong&gt; — Get the last visited URL for display or custom logic.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to Use ngx-navigate-back
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Install the Package&lt;/strong&gt;&lt;br&gt;
Install ngx-navigate-back using npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install ngx-navigate-back
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Import the Service&lt;/strong&gt;&lt;br&gt;
Import NgxNavigateBackService in your Angular component:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { NgxNavigateBackService } from 'ngx-navigate-back';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Inject the Service &amp;amp; Start Recording History&lt;/strong&gt;&lt;br&gt;
In your component constructor, inject the service and start tracking navigation history:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;constructor(public navigation: NgxNavigateBackService) {
  this.navigation.recordUrlHistory();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Implement the Back Button&lt;/strong&gt;&lt;br&gt;
Use the navigateBack() function to navigate back and getLastUrl() to retrieve the last visited URL:&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;button (click)="navigation.navigateBack()"&amp;gt;Back to Previous Page {{ navigation.getLastUrl() }}&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Get Started with ngx-navigate-back
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fk3qbwj29uvxgil10qina.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fk3qbwj29uvxgil10qina.png" alt="Improve user experience in your Angular app with ngx-navigate-back" width="400" height="400"&gt;&lt;/a&gt;&lt;br&gt;
Improve user experience in your Angular app with ngx-navigate-back.&lt;/p&gt;

&lt;p&gt;Get started now! Install the package and explore its features:&lt;br&gt;
&lt;a href="https://github.com/developwithmi/ngx-navigate-back" rel="noopener noreferrer"&gt;🔗 ngx-navigate-back on GitHub&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Let me know if you need any modifications or additional details! 🚀&lt;/p&gt;

&lt;p&gt;If you found this helpful, let’s connect!&lt;br&gt;
🔹 Follow me on GitHub for more open-source projects: &lt;a href="https://github.com/midhul-p" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;br&gt;
🔹 Follow me on LinkedIn to stay updated: &lt;a href="https://in.linkedin.com/in/iammidhul" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;This article is Originally posted on Medium: &lt;a href="https://medium.com/understanding-javascript-developwithmi/your-angular-app-needs-a-smarter-back-button-heres-how-e4bd5b8ec986" rel="noopener noreferrer"&gt;Read here&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/understanding-javascript-developwithmi/your-angular-app-needs-a-smarter-back-button-heres-how-e4bd5b8ec986" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afill%3A88%3A88%2F1%2AtneqBgoHO2B2WLbvHXODtg.jpeg" alt="Midhul"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/understanding-javascript-developwithmi/your-angular-app-needs-a-smarter-back-button-heres-how-e4bd5b8ec986" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Your Angular App Needs a Smarter Back Button — Here’s How | by Midhul | Developwithmi | Feb, 2025 | Medium&lt;/h2&gt;
      &lt;h3&gt;Midhul ・ &lt;time&gt;Feb 21, 2025&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fmedium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>angular</category>
      <category>frontend</category>
    </item>
    <item>
      <title>The Most Elegant Implementation of Light &amp; Dark Mode in Angular! 🌗</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Fri, 07 Feb 2025 06:43:26 +0000</pubDate>
      <link>https://dev.to/midhul/the-most-elegant-implementation-of-light-dark-mode-in-angular-2b1m</link>
      <guid>https://dev.to/midhul/the-most-elegant-implementation-of-light-dark-mode-in-angular-2b1m</guid>
      <description>&lt;p&gt;Dark mode isn’t just a feature anymore—it’s a must-have. But are you implementing it the right way?&lt;/p&gt;

&lt;p&gt;Most tutorials tell you to toggle a '.dark-theme' class on body, but that’s outdated. There’s a better approach! 🚀&lt;/p&gt;

&lt;p&gt;🔥 Use the data-theme attribute on html with CSS variables!&lt;/p&gt;

&lt;p&gt;Why? Because it’s:&lt;br&gt;
✅ More performant – No unnecessary class toggling.&lt;br&gt;
✅ Cleaner &amp;amp; scalable – Let CSS do the heavy lifting.&lt;br&gt;
✅ Easier to manage – No messy DOM manipulation.&lt;/p&gt;

&lt;p&gt;In my latest blog, I break down the most efficient way to add a theme toggle in Angular—with smooth transitions and saved preferences using localStorage.&lt;/p&gt;

&lt;p&gt;💡 Curious? Read the full article for FREE on Medium:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/understanding-javascript-developwithmi/light-dark-mode-in-angular-the-most-elegant-implementation-96a1adefa978?sk=3bb857cd8954c88bde2d8b4affb993e8" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afill%3A88%3A88%2F1%2AtneqBgoHO2B2WLbvHXODtg.jpeg" alt="Midhul"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/understanding-javascript-developwithmi/light-dark-mode-in-angular-the-most-elegant-implementation-96a1adefa978?sk=3bb857cd8954c88bde2d8b4affb993e8" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;The Most Elegant Implementation of Light &amp;amp; Dark Mode in Angular! | Developwithmi | Developwithmi&lt;/h2&gt;
      &lt;h3&gt;Midhul ・ &lt;time&gt;Feb 7, 2025&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fmedium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Let’s make theme switching seamless! Let me know your thoughts. 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Add a Dark Mode Toggle in Angular</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Thu, 06 Feb 2025 07:48:04 +0000</pubDate>
      <link>https://dev.to/midhul/how-to-add-a-dark-mode-toggle-in-angular-3io0</link>
      <guid>https://dev.to/midhul/how-to-add-a-dark-mode-toggle-in-angular-3io0</guid>
      <description>&lt;p&gt;Hey folks! I recently wrote a blog on how to implement a Dark Mode Toggle in Angular over on Medium. If you're looking to add a sleek dark mode option to your Angular apps, check it out!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read it for free on Medium&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/understanding-javascript-developwithmi/implementing-dark-mode-toggle-in-angular-0674e10b65e0?sk=173ae47567ad250a5eb3d3bbd816329c" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afill%3A88%3A88%2F1%2AtneqBgoHO2B2WLbvHXODtg.jpeg" alt="Midhul"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/understanding-javascript-developwithmi/implementing-dark-mode-toggle-in-angular-0674e10b65e0?sk=173ae47567ad250a5eb3d3bbd816329c" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Implementing Dark Mode Toggle in Angular | by Midhul | Developwithmi | Feb, 2025 | Medium&lt;/h2&gt;
      &lt;h3&gt;Midhul ・ &lt;time&gt;Feb 3, 2025&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fmedium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>angular</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>8 Essential JavaScript Array Methods</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Fri, 08 Nov 2024 05:12:55 +0000</pubDate>
      <link>https://dev.to/midhul/8-essential-javascript-array-methods-35l9</link>
      <guid>https://dev.to/midhul/8-essential-javascript-array-methods-35l9</guid>
      <description>&lt;p&gt;JavaScript arrays come with powerful one-liners that make coding simpler and cleaner. Here’s a quick guide to mastering some key array methods:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filtering an Array:&lt;/strong&gt; .filter() creates a new array with elements passing a test.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const oddNumbers = [1, 2, 3, 4, 5, 6].filter(num =&amp;gt; num % 2 !== 0); // [1, 3, 5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Mapping an Array:&lt;/strong&gt; .map() applies a function to every element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const doubled = [1, 2, 3, 4, 5].map(num =&amp;gt; num * 2); // [2, 4, 6, 8, 10]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Reducing an Array:&lt;/strong&gt; .reduce() processes all elements to produce a single result.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sum = [1, 2, 3, 4, 5].reduce((total, num) =&amp;gt; total + num, 0); // 15

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

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;Finding an Element: *&lt;/em&gt;.find() returns the first element meeting a condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const firstEven = [1, 2, 3, 4, 5].find(num =&amp;gt; num % 2 === 0); // 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Checking Conditions:&lt;/strong&gt; .some() and .every() check if any or all elements pass a test.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const hasEven = [1, 3, 5, 7, 8].some(num =&amp;gt; num % 2 === 0); // true

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Flattening an Array:&lt;/strong&gt; .flat() turns nested arrays into a single-level array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const flattened = [1, [2, 3], [4, [5, 6]]].flat(2); // [1, 2, 3, 4, 5, 6]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Removing Duplicates:&lt;/strong&gt; Using Set removes duplicates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const uniqueNumbers = [...new Set([1, 2, 2, 3, 4, 4, 5])]; // [1, 2, 3, 4, 5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sorting an Array:&lt;/strong&gt; .sort() arranges numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sortedNumbers = [5, 2, 9, 1, 5, 6].sort((a, b) =&amp;gt; a - b); // [1, 2, 5, 5, 6, 9]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These one-liners can significantly streamline your code. &lt;strong&gt;To dive deeper, check out my &lt;a href="https://medium.com/understanding-javascript-developwithmi/this-cheat-sheet-will-make-you-javascript-array-ninja-4869a9b6f539?sk=ec739e69ee741d072085bde4fc91984b" rel="noopener noreferrer"&gt;JavaScript cheatsheet and more&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Handling Async Errors in JavaScript: A Quick Guide</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Wed, 06 Nov 2024 03:38:46 +0000</pubDate>
      <link>https://dev.to/midhul/handling-async-errors-in-javascript-a-quick-guide-4nj3</link>
      <guid>https://dev.to/midhul/handling-async-errors-in-javascript-a-quick-guide-4nj3</guid>
      <description>&lt;p&gt;Async errors in JavaScript arise when operations like network requests or file I/O fail unexpectedly. Without proper handling, these errors can lead to app crashes or erratic behavior. Here’s a brief guide on some effective ways to manage async errors in your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Try-Catch with Async/Await
&lt;/h2&gt;

&lt;p&gt;For async functions, wrapping code in a try-catch block lets you handle errors gracefully. Here’s how:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;async function fetchData() {
  try {
    const response = await fetch('https://api.example.com/data');
    const data = await response.json();
    console.log(data); // Process data
  } catch (error) {
    console.error('Fetch error:', error); // Handle error
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Handling Promise Rejections
&lt;/h2&gt;

&lt;p&gt;If you’re working with promises directly, the &lt;code&gt;.catch()&lt;/code&gt; method allows you to handle rejections easily:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch('https://api.example.com/data')
  .then(response =&amp;gt; response.json())
  .then(data =&amp;gt; console.log(data))
  .catch(error =&amp;gt; console.error('Promise rejection:', error));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Global Error Handling
&lt;/h2&gt;

&lt;p&gt;To catch any unhandled rejections across your application, use the &lt;code&gt;unhandledrejection&lt;/code&gt; event:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.addEventListener('unhandledrejection', event =&amp;gt; {
  console.error('Unhandled rejection:', event.reason);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Logging and Reporting Errors
&lt;/h2&gt;

&lt;p&gt;While logging errors to the console works for development, production apps benefit from dedicated error-tracking tools like Sentry or LogRocket.&lt;/p&gt;

&lt;p&gt;For a more in-depth look at async error handling, check out my full article on Medium: &lt;a href="https://medium.com/understanding-javascript-developwithmi/how-to-handle-javascript-async-errors-a-practical-guide-5d23153ddd7c?sk=903bf262b5562a3df3941cb2b0ce8234" rel="noopener noreferrer"&gt;How to Handle JavaScript Async Errors : A Practical Guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>frontend</category>
    </item>
    <item>
      <title>A Beginner's Guide to JavaScript Closures</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Tue, 05 Nov 2024 05:04:13 +0000</pubDate>
      <link>https://dev.to/midhul/a-beginners-guide-to-javascript-closures-57gl</link>
      <guid>https://dev.to/midhul/a-beginners-guide-to-javascript-closures-57gl</guid>
      <description>&lt;p&gt;In JavaScript, a closure is a function that retains access to variables from its parent scope, even after the parent function has completed. This unique behaviour allows functions to "remember" their context, making closures invaluable for managing private data and structuring complex code.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Use Closures?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Closures are essential for creating private variables and encapsulated logic. By wrapping functionality in a closure, you can protect variables from external interference, keeping code organised and secure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of a Closure: Simple Counter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's a common use of closures, where we build a counter function that retains a private count variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function makeCounter() {
    let count = 0;

    return function() {
        count++;
        console.log(count);
    };
}

let counter = makeCounter();
counter(); // Logs: 1
counter(); // Logs: 2
counter(); // Logs: 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each time &lt;code&gt;counter()&lt;/code&gt; is called, it accesses and increments the private count variable, which is only accessible inside &lt;code&gt;makeCounter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Example: Login Manager&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Closures are also useful for more complex scenarios, like managing user login states. Here’s a login manager with private state control:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function createLoginManager() {
    let isLoggedIn = false;

    return {
        login: function() { isLoggedIn = true; },
        logout: function() { isLoggedIn = false; },
        isLoggedIn: function() { return isLoggedIn; }
    };
}

let loginManager = createLoginManager();
console.log(loginManager.isLoggedIn()); // false
loginManager.login();
console.log(loginManager.isLoggedIn()); // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;isLoggedIn&lt;/code&gt; variable is encapsulated within &lt;code&gt;createLoginManager&lt;/code&gt;, accessible only through the returned methods. This approach keeps login information secure and well-organized.&lt;/p&gt;

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

&lt;p&gt;Closures might seem tricky at first, but they’re a powerful tool for organizing JavaScript code, making it both secure and maintainable.&lt;/p&gt;

&lt;p&gt;To explore more about JavaScript closures with additional examples and insights, check out my full article on Medium: &lt;a href="https://medium.com/understanding-javascript-developwithmi/what-is-javascript-closures-a-practical-guide-7b323e682f67?sk=bbfcee3fba3ec4408dfd547571d33a8b" rel="noopener noreferrer"&gt;What is JavaScript Closures? A Practical Guide.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Are You a Front-End Developer Struggling with Self-Doubt?</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Fri, 25 Oct 2024 05:22:11 +0000</pubDate>
      <link>https://dev.to/midhul/are-you-a-front-end-developer-struggling-with-self-doubt-29p9</link>
      <guid>https://dev.to/midhul/are-you-a-front-end-developer-struggling-with-self-doubt-29p9</guid>
      <description>&lt;p&gt;If you’ve ever questioned your own abilities or felt like an imposter in the world of front-end development, know that you’re not alone. Imposter syndrome affects developers at all levels, often holding them back from feeling fulfilled in their roles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are a few common signs to look out for:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Discounting Your Achievements&lt;/strong&gt; - Downplaying your hard work or chalking it up to “just luck.”&lt;br&gt;
&lt;strong&gt;Comparing to Others&lt;/strong&gt; - Feeling inadequate when you see others who seem more skilled.&lt;br&gt;
&lt;strong&gt;Perfectionism&lt;/strong&gt; - Setting impossible standards that lead to stress and procrastination.&lt;/p&gt;

&lt;p&gt;Overcoming these feelings involves reframing your mindset and embracing growth over perfection. Building a support network and celebrating small wins can also make a huge difference. With the right tools and a focus on learning, you can silence your inner critic and thrive in your development career.&lt;/p&gt;

&lt;p&gt;To learn more about recognising and tackling imposter syndrome, read &lt;a href="https://medium.com/understanding-javascript-developwithmi/imposter-syndrome-how-to-overcome-self-doubt-as-a-front-end-developer-53ca73a34c70?sk=441b20cedb87f6032feeb566fdb97b3e" rel="noopener noreferrer"&gt;my full article on Medium&lt;/a&gt;, where I dive into practical strategies for front-end developers to overcome self-doubt and unlock their potential.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/understanding-javascript-developwithmi/imposter-syndrome-how-to-overcome-self-doubt-as-a-front-end-developer-53ca73a34c70?sk=441b20cedb87f6032feeb566fdb97b3e" rel="noopener noreferrer"&gt;Imposter syndrome,How to Overcome Self-Doubt as a Front-End Developer&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>productivity</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>How to use JavaScript Classes in real projects</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Thu, 24 Oct 2024 06:57:46 +0000</pubDate>
      <link>https://dev.to/midhul/how-to-use-javascript-classes-in-real-projects-i3p</link>
      <guid>https://dev.to/midhul/how-to-use-javascript-classes-in-real-projects-i3p</guid>
      <description>&lt;p&gt;JavaScript classes are a great way to organize code. Let’s see how you can use them in a simple To-Do List app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Declaring a Class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We define a Task class to manage tasks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Task {
  constructor(description, dueDate) {
    this.description = description;
    this.dueDate = dueDate;
    this.isDone = false;
  }

  markAsDone() {
    this.isDone = true;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating Instances&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can create tasks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const task1 = new Task('Write blog post', '2023-11-15');
task1.markAsDone();
console.log(task1); 
// Task { description: 'Write blog post', dueDate: '2023-11-15', isDone: true }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Extend the Task class for specific types of tasks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class ShoppingTask extends Task {
  constructor(description, dueDate, items) {
    super(description, dueDate);
    this.items = items;
  }
}

const shoppingTask = new ShoppingTask('Buy groceries', '2023-11-20', ['Apples', 'Milk']);
console.log(shoppingTask); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Static Methods &amp;amp; Getters/Setters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can add static methods for sorting tasks and use getters and setters to manage data validation.&lt;/p&gt;

&lt;p&gt;For a more detailed guide, check out my full post on Medium: &lt;a href="https://medium.com/understanding-javascript-developwithmi/how-to-use-javascript-classes-in-real-projects-f48820416c67" rel="noopener noreferrer"&gt;How to Use JavaScript Classes in Real Projects.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Organise JavaScript Code with Modules: A Practical Guide</title>
      <dc:creator>Midhul P</dc:creator>
      <pubDate>Wed, 23 Oct 2024 08:35:19 +0000</pubDate>
      <link>https://dev.to/midhul/how-to-organise-javascript-code-with-modules-a-practical-guide-4ph0</link>
      <guid>https://dev.to/midhul/how-to-organise-javascript-code-with-modules-a-practical-guide-4ph0</guid>
      <description>&lt;p&gt;JavaScript is a powerful programming language that enables developers to build dynamic and interactive web applications. One of its essential features is modularity, allowing code organization for better reuse and maintainability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are Modules in JavaScript?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Modules are self-contained pieces of code that encapsulate specific functionalities, variables, and methods. They enable developers to break down applications into manageable parts, making maintenance, testing, and debugging easier.&lt;/p&gt;

&lt;p&gt;With ES6, JavaScript introduced the import and export keywords for module creation, moving away from older methods like RequireJS and CommonJS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Modules&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To create a module, define the functionality you want to encapsulate. For example, consider a module for calculating the area of a rectangle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// rectangle.js
export function calculateArea(width, height) {
  return width * height;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using Modules&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To use the calculateArea function in another file, import the module&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { calculateArea } from './rectangle.js';
console.log(calculateArea(10, 5)); // Outputs: 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Benefits of Modules&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Encapsulation&lt;/em&gt;: Keeps code organized and manageable.&lt;br&gt;
&lt;em&gt;Reusability&lt;/em&gt;: Reduces code duplication across the application.&lt;br&gt;
&lt;em&gt;Performance&lt;/em&gt;: Loads only necessary code, improving application speed.&lt;br&gt;
&lt;em&gt;Testing&lt;/em&gt;: Facilitates easier isolation for testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To see how we can use modules to manage different functionalities in a practical context:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://medium.com/understanding-javascript-developwithmi/organize-your-javascript-code-with-modules-a-practical-guide-fac9dc74601d?sk=45579258d7b42203c7539d62dd6cc54b" rel="noopener noreferrer"&gt;Read the full blog here!&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll find detailed implementations of modules for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Searching for books&lt;/li&gt;
&lt;li&gt;Displaying book details&lt;/li&gt;
&lt;li&gt;Managing a shopping cart&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’d love to hear your feedback and thoughts!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
