<?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: Robiul</title>
    <description>The latest articles on DEV Community by Robiul (@robiulman).</description>
    <link>https://dev.to/robiulman</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%2F394465%2F57b6c50d-463f-4792-aeb6-2f3e65069f6a.jpg</url>
      <title>DEV Community: Robiul</title>
      <link>https://dev.to/robiulman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/robiulman"/>
    <language>en</language>
    <item>
      <title>🚧 nextjs and strapi CI/CD, Docker, and the Mystery of the Failing API: A Real-World Debugging Story</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Sun, 04 Jan 2026 08:51:10 +0000</pubDate>
      <link>https://dev.to/robiulman/nextjs-and-strapi-cicd-docker-and-the-mystery-of-the-failing-api-a-real-world-debugging-story-59jp</link>
      <guid>https://dev.to/robiulman/nextjs-and-strapi-cicd-docker-and-the-mystery-of-the-failing-api-a-real-world-debugging-story-59jp</guid>
      <description>&lt;h1&gt;
  
  
  We Learn From Mistakes: A Real-World CI/CD Debugging Story
&lt;/h1&gt;

&lt;p&gt;When you're a developer working with modern stacks like &lt;strong&gt;Strapi&lt;/strong&gt;, &lt;strong&gt;Next.js&lt;/strong&gt;, and &lt;strong&gt;Docker&lt;/strong&gt;, setting up a CI/CD pipeline feels like a milestone. But sometimes, that smooth automation dream turns into a long night of debugging. This is the story of how I chased down a strange API error—and what I learned along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ The Setup
&lt;/h2&gt;

&lt;p&gt;Our stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Strapi&lt;/strong&gt; backend&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next.js&lt;/strong&gt; frontend&lt;/li&gt;
&lt;li&gt;Dockerized deployment&lt;/li&gt;
&lt;li&gt;CI/CD pipeline for auto-deployments&lt;/li&gt;
&lt;li&gt;Self-hosted Linux server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything ran smoothly on local development, and even on &lt;strong&gt;Vercel&lt;/strong&gt; (for testing the frontend alone). But once deployed on our &lt;strong&gt;self-hosted&lt;/strong&gt; server, the app broke.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧨 The Error
&lt;/h2&gt;

&lt;p&gt;Next.js was throwing a cryptic error when trying to fetch data from Strapi:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;API or validation error: TypeError: fetch failed
    at async s &lt;span class="o"&gt;(&lt;/span&gt;.next/server/chunks/507.js:1:806&lt;span class="o"&gt;)&lt;/span&gt;
    at async m &lt;span class="o"&gt;(&lt;/span&gt;.next/server/app/categories/page.js:1:747&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;cause]: &lt;span class="o"&gt;[&lt;/span&gt;Error &lt;span class="o"&gt;[&lt;/span&gt;ConnectTimeoutError]: Connect Timeout Error] &lt;span class="o"&gt;{&lt;/span&gt;
    code: &lt;span class="s1"&gt;'UND_ERR_CONNECT_TIMEOUT'&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It didn't make sense. Why would &lt;strong&gt;fetch&lt;/strong&gt; fail only on the deployed version and not on local or Vercel?&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 The Investigation
&lt;/h2&gt;

&lt;p&gt;Here's how I tackled it step-by-step:&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Step 1: Reproduce Locally
&lt;/h3&gt;

&lt;p&gt;I ran the same Next.js app with Strapi in Docker &lt;strong&gt;locally&lt;/strong&gt; and everything worked fine—even when using Postman or &lt;code&gt;curl&lt;/code&gt; to test the API. So, it wasn't a code issue.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧱 Step 2: Check Docker Networking
&lt;/h3&gt;

&lt;p&gt;Maybe Docker containers couldn't talk to each other? I made sure both services were on the same Docker network and updated API calls to use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://strapi:1337
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the error still persisted. 😩&lt;/p&gt;

&lt;h3&gt;
  
  
  🔎 Step 3: Look Into the Build Artifacts
&lt;/h3&gt;

&lt;p&gt;Next.js stores route logic inside &lt;code&gt;.next/server/app&lt;/code&gt;. I inspected &lt;code&gt;.next/server/app/categories/page.js&lt;/code&gt; to see if something was off. But everything seemed normal.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⏱️ Step 4: Increase Timeouts and CORS Configs
&lt;/h3&gt;

&lt;p&gt;I suspected timeout issues and CORS misconfigurations. So I:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Increased the fetch timeout in Next.js&lt;/li&gt;
&lt;li&gt;Rechecked Strapi's &lt;code&gt;middleware.js&lt;/code&gt; for proper CORS headers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Still nothing.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧪 Step 5: Strip Docker from the Equation
&lt;/h3&gt;

&lt;p&gt;Out of desperation, I ran the entire stack &lt;strong&gt;without Docker&lt;/strong&gt; on the same self-hosted server. And guess what? It worked.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 The Real Culprit: Network Restrictions
&lt;/h2&gt;

&lt;p&gt;This confirmed it: the issue wasn't with the code, or Docker, or even the CI/CD pipeline. It was a &lt;strong&gt;network access issue&lt;/strong&gt; on the host server. Specifically, the server had restrictions that blocked container-to-container communication or DNS resolution for internal Docker service names.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ The Fix
&lt;/h2&gt;

&lt;p&gt;The solution was simple once I understood the problem:&lt;/p&gt;

&lt;p&gt;✅ I configured Strapi with a &lt;strong&gt;real domain name&lt;/strong&gt;, like &lt;code&gt;https://api.myapp.com&lt;/code&gt;, and updated the frontend to fetch from that instead of &lt;code&gt;http://strapi:1337&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After that, I redeployed using the same Docker + CI/CD pipeline—and everything worked. 🥳&lt;/p&gt;

&lt;h2&gt;
  
  
  🔚 Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;Solution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;fetch failed&lt;/code&gt; error with timeout on deployed Next.js&lt;/td&gt;
&lt;td&gt;Diagnosed as a network-level issue on self-hosted server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Docker service name (&lt;code&gt;strapi&lt;/code&gt;) didn't resolve&lt;/td&gt;
&lt;td&gt;Replaced with real domain name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CI/CD + Docker setup was fine&lt;/td&gt;
&lt;td&gt;But host server's networking caused the fetch to fail&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  📝 Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker networking can behave differently across environments.&lt;/strong&gt; What works locally might not work on production.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Don't overlook your host's firewall, DNS, or networking rules.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real domain names can often solve connectivity issues&lt;/strong&gt;, especially across containers and services.&lt;/li&gt;
&lt;li&gt;Debugging isn't always about code—sometimes, it's about the infrastructure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope this saves someone else a few hours (or days) of head-scratching!&lt;br&gt;&lt;br&gt;
Let me know if you've hit similar issues—I’d love to hear how you solved them.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>docker</category>
      <category>nextjs</category>
      <category>cicd</category>
    </item>
    <item>
      <title>Tp link Archer T2U Plus wifi adapter install on linux</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Sat, 18 Jan 2025 20:19:26 +0000</pubDate>
      <link>https://dev.to/robiulman/tp-link-archer-t2u-plus-wifi-adapter-instaill-on-linux-3cno</link>
      <guid>https://dev.to/robiulman/tp-link-archer-t2u-plus-wifi-adapter-instaill-on-linux-3cno</guid>
      <description>&lt;h1&gt;
  
  
  Installing Tp link Archer T2U Plus adapter RTL8821AU WiFi Driver on Linux
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Install Correct Driver
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repository:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/morrownr/8821au-20210708.git
&lt;span class="nb"&gt;cd &lt;/span&gt;8821au-20210708
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install build dependencies (for Ubuntu/Debian):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; dkms bc build-essential git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run installation script:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; ./install-driver.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Reboot system:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;If WiFi networks aren't showing after reboot, check:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verify adapter is recognized:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsusb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for "TP-Link" in the output.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check if interface is up:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;iwconfig
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If issues persist, additional troubleshooting may be needed.&lt;/p&gt;

</description>
      <category>wifi</category>
      <category>linux</category>
    </item>
    <item>
      <title>Data Structures &amp; Algorithm Linked List Day 1</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Sat, 12 Oct 2024 19:43:00 +0000</pubDate>
      <link>https://dev.to/robiulman/data-structures-algorithm-linked-list-4356</link>
      <guid>https://dev.to/robiulman/data-structures-algorithm-linked-list-4356</guid>
      <description>&lt;p&gt;Day 1&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic data structures
&lt;/h3&gt;

&lt;p&gt;We won't just learn about linked lists in the traditional way; we will also explore what the Node and LinkedList classes are, as well as all the operations that can be performed on them.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Linked List?
&lt;/h3&gt;

&lt;p&gt;A linked list is a collection of elements called nodes, where each node contains a data element and a reference (or link) to the next node in the sequence.&lt;br&gt;
A linked list is a linear data structure in which elements are stored in nodes. Each node contains two parts:&lt;br&gt;
Unlike arrays, *&lt;em&gt;linked lists don’t store elements in contiguous memory locations.&lt;br&gt;
*&lt;/em&gt; Instead, each node points to the next node, allowing dynamic memory usage and easy insertion or deletion of elements.&lt;/p&gt;
&lt;h3&gt;
  
  
  key point of Linked List
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Node Structure:&lt;/strong&gt; Linked lists consist of nodes, each containing a value and a reference to the next node. Exploring the structure and properties of nodes helps in understanding how linked lists organize and store data. &lt;br&gt;
&lt;strong&gt;2.  Head and Tail:&lt;/strong&gt; The first node in a linked list is called the head, while the last node is referred to as the tail. Understanding the characteristics and functionality of the head and tail nodes is crucial for efficient traversal and manipulation of linked lists.&lt;/p&gt;
&lt;h3&gt;
  
  
  Key Characteristics:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Dynamic size:&lt;/strong&gt; It can grow or shrink as needed.&lt;br&gt;
&lt;strong&gt;Sequential access:&lt;/strong&gt; Accessing elements requires traversing from the first node (head).&lt;/p&gt;
&lt;h3&gt;
  
  
  Types of Linked Lists:
&lt;/h3&gt;

&lt;p&gt;There are three basic forms of linked lists&lt;br&gt;
&lt;strong&gt;1. Singly linked lists.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2. Doubly linked lists.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;3. Circular linked lists.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In This article, We will explore Singly-linked lists.&lt;/p&gt;
&lt;h4&gt;
  
  
  Singly linked lists.
&lt;/h4&gt;

&lt;p&gt;Each node has a reference to the next node.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each node contains:

&lt;ul&gt;
&lt;li&gt;Data (the value you want to store).&lt;/li&gt;
&lt;li&gt;A next pointer, which points to the next node in the sequence.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The last node’s next pointer is null because there’s no node after it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Analogy:&lt;/strong&gt; Arrow – Once an arrow is shot, it can only travel forward.&lt;br&gt;
Once the arrow is released, it flies in a straight line without the ability to return.&lt;br&gt;
Similarly, in Singly Linked List, once you move from one node to the next, you cannot go back—you can only continue moving forward.&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%2Fzhplrlvjipp0cra7r70r.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%2Fzhplrlvjipp0cra7r70r.png" alt="Image description" width="720" height="270"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Data | Next&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt; &lt;span class="s"&gt;-&amp;gt; [Data | Next] -&amp;gt; [Data | Next] -&amp;gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Operations on Singly Linked List
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Insertion:

&lt;ul&gt;
&lt;li&gt;Insert at the beginning&lt;/li&gt;
&lt;li&gt;Insert at the end&lt;/li&gt;
&lt;li&gt;Insert at a specific position&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Deletion:

&lt;ul&gt;
&lt;li&gt;Delete from the beginning&lt;/li&gt;
&lt;li&gt;Delete from the end&lt;/li&gt;
&lt;li&gt;Delete a specific node&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Traversal&lt;/li&gt;

&lt;li&gt;Searching&lt;/li&gt;

&lt;li&gt;Length&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Insertion:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Insert at the beginning
&lt;/h4&gt;

&lt;p&gt;Let's create a Node class&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;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s break down the Node class.&lt;/p&gt;

&lt;p&gt;**The Node class represents each individual element in a linked list. Each node contains two properties:&lt;/p&gt;

&lt;h4&gt;
  
  
  Properties:
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;- Data:&lt;/strong&gt; This holds the value stored in the node (such as a number, string, or object).&lt;br&gt;
&lt;strong&gt;- Next:&lt;/strong&gt; This holds a reference (or pointer) to the next node in the linked list. Initially, it's set to null because when a node is created, it's not yet linked to any other node.&lt;/p&gt;
&lt;h4&gt;
  
  
  Breakdown:
&lt;/h4&gt;

&lt;p&gt;Constructor (&lt;code&gt;constructor(data)&lt;/code&gt;):&lt;br&gt;
This is a special method in JavaScript classes that is called when a new instance of the Node class is created.&lt;br&gt;
The data parameter is passed in when creating a new node, and it stores the actual value of the node.&lt;br&gt;
this.next = null; sets the next property to null initially because when a node is created, it's not connected to any other node yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&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;node1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Create a node with the value 10&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;node1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// Output: 10&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;node1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// Output: null (because it's not linked to any other node yet)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's create a SinglyLinkList class&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;class&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Initially, the list is empty, so the head is null.&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// The size is initially 0, as there are no nodes in the list.&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Insert at the beginning&lt;/span&gt;
  &lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Create a new node with the given data&lt;/span&gt;
    &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// The new node's next points to the current head&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Update the head to be the new node&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Increment the size of the list&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;The SinglyLinkedList class represents the entire linked list structure. It manages multiple Node objects and provides methods for working with the list, &lt;strong&gt;such as inserting, deleting, and traversing nodes and so on&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Properties:
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;- Head:&lt;/strong&gt; This is a reference to the first node (or the "head") of the linked list. Initially, it is set to null, meaning the list is empty.&lt;br&gt;
&lt;strong&gt;- Size:&lt;/strong&gt; This keeps track of how many nodes are currently in the linked list. Initially, it’s set to 0 since the list is empty.&lt;/p&gt;
&lt;h4&gt;
  
  
  Breakdown:
&lt;/h4&gt;

&lt;p&gt;Constructor (&lt;code&gt;constructor()&lt;/code&gt;):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;this.head = null;&lt;/code&gt;: This initializes the linked list with no elements, so the head points to &lt;code&gt;null&lt;/code&gt;.&lt;br&gt;
&lt;code&gt;this.size = 0;&lt;/code&gt;: The size starts as &lt;code&gt;0&lt;/code&gt; because there are no nodes in the list.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;insertAtBeginning(data)&lt;/code&gt;: for the sake of simplicity, later on, we will Deep Dive into the &lt;code&gt;insertAtBeginning(data)&lt;/code&gt; method&lt;br&gt;
&lt;code&gt;let newNode = new Node(data);&lt;/code&gt;: This creates a new node with the value passed in as &lt;code&gt;data&lt;/code&gt;.&lt;br&gt;
&lt;code&gt;newNode.next = this.head;&lt;/code&gt;: This links the new node to the current head (which could be &lt;code&gt;null&lt;/code&gt;if the list is empty or point to an existing node if the list has elements).&lt;br&gt;
&lt;code&gt;this.head = newNode;&lt;/code&gt;: This updates the head of the list to point to the new node, making it the first node in the list.&lt;br&gt;
&lt;code&gt;this.size++;&lt;/code&gt;: The size of the linked list is increased by 1 as a new node has been added.&lt;/p&gt;

&lt;p&gt;let's Test&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;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// List becomes: 10&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// List becomes: 20 -&amp;gt; 10&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;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 20 (since the head is now the first node with value 20)&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;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;      &lt;span class="c1"&gt;// Output: 2 (since there are two nodes in the list)&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Linked List deep dive Line by Line.
&lt;/h3&gt;

&lt;p&gt;let's jump into the &lt;code&gt;insertAtBeginning(data)&lt;/code&gt; method .&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;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Insert a new node at the beginning of the list&lt;/span&gt;
  &lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;given&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


    &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Example Usage:&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&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="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;output example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;SinglyLinkedList &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;head&lt;/span&gt;: Node &lt;span class="o"&gt;{&lt;/span&gt; data: 20, next: Node &lt;span class="o"&gt;{&lt;/span&gt; data: 10, next: null &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;,
  size: 2
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What Each Step Does
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Node Class:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;this.data&lt;/code&gt;: Stores the data for the node.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;this.next&lt;/code&gt;: Points to the next node in the list (initialized to &lt;code&gt;null&lt;/code&gt; because the node is alone at first).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  SinglyLinkedList Class:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;this.head&lt;/code&gt;: Keeps track of the first node in the list (the "head").&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;this.size&lt;/code&gt;: Tracks the number of nodes in the list.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  insertAtBeginning():
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new node is created using the &lt;code&gt;Node&lt;/code&gt; class, and it stores the data provided.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This new node points to the current head of the list (whatever it may be, even if &lt;code&gt;null&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The new node becomes the head of the list, taking the top position.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The size of the list is increased by 1 each time a new node is added.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What Happens During Execution
&lt;/h3&gt;

&lt;h4&gt;
  
  
  When you insert &lt;code&gt;10&lt;/code&gt;:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new node is created with &lt;code&gt;data: 10&lt;/code&gt; and &lt;code&gt;next: null&lt;/code&gt; (since it's the first node).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This new node becomes the head of the list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The size becomes 1.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  When you insert &lt;code&gt;20&lt;/code&gt;:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new node is created with &lt;code&gt;data: 20&lt;/code&gt; and &lt;code&gt;next&lt;/code&gt; pointing to the previous node (which has &lt;code&gt;data: 10&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This new node becomes the head of the list, pushing the &lt;code&gt;10&lt;/code&gt; node down.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The size becomes 2.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;h4&gt;
  
  
  The final structure of the list will be:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The head points to the node with data &lt;code&gt;20&lt;/code&gt;, which points to the node with data &lt;code&gt;10&lt;/code&gt;. The node with &lt;code&gt;10&lt;/code&gt; has &lt;code&gt;next: null&lt;/code&gt;, marking the end of the list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The list size is 2.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Insert at the end
&lt;/h3&gt;

&lt;p&gt;Let's talk about Insert at the end&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;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Insert at the end&lt;/span&gt;
  &lt;span class="nf"&gt;insertAtEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Example Usage:&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&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="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;output example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;SinglyLinkedList &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;head&lt;/span&gt;: Node &lt;span class="o"&gt;{&lt;/span&gt; data: 10, next: Node &lt;span class="o"&gt;{&lt;/span&gt; data: 20, next: Node &lt;span class="o"&gt;{&lt;/span&gt; data: 30, next: null &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;,
  size: 3
&lt;span class="o"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;insertAtEnd()&lt;/code&gt; Method Explanation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new node is created using the &lt;code&gt;Node&lt;/code&gt;class. This node will store the data provided and its &lt;code&gt;next&lt;/code&gt;pointer will initially be &lt;code&gt;null&lt;/code&gt;(since it will be the last node in the list)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the list is empty (head is &lt;code&gt;null&lt;/code&gt;), the new node is set as the head of the list. This means the list will only have one node, and this new node will be the first (and only) element in the list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the list is not empty, we need to traverse the list to find the last node (the node whose &lt;code&gt;next&lt;/code&gt;is &lt;code&gt;null&lt;/code&gt;). We start from the head and move from one node to the next until we reach the last node.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once we find the last node, we set its &lt;code&gt;next&lt;/code&gt;pointer to the newly created node. This effectively adds the new node to the end of the list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The size of the list is increased by 1 each time a new node is added at the end.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  What Happens During Execution
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;When You Insert 10 (First Insertion):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new node is created with &lt;code&gt;data: 10&lt;/code&gt; and &lt;code&gt;next: null&lt;/code&gt; (since it’s the only node and hence the last).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since the list is empty (head is &lt;code&gt;null&lt;/code&gt;), this new node becomes the head of the list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The list size becomes &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When You Insert 20 (Second Insertion):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new node is created with &lt;code&gt;data: 20&lt;/code&gt; and &lt;code&gt;next: null&lt;/code&gt; (it will be the new last node).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The list is not empty, so we traverse the list starting from the head to find the last node (which currently holds the data &lt;code&gt;10&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The next pointer of the last node (node with data: &lt;code&gt;10&lt;/code&gt;) is updated to point to the new node with &lt;code&gt;data: 20&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The list size becomes &lt;code&gt;2&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When You Insert 30 (Third Insertion):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new node is created with &lt;code&gt;data: 30&lt;/code&gt; and &lt;code&gt;next: null&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We traverse the list to find the current last node, which is the node with &lt;code&gt;data: 20&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;next&lt;/code&gt;pointer of the last node (node with &lt;code&gt;data: 20&lt;/code&gt;) is updated to point to the new node with &lt;code&gt;data: 30&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The list size becomes &lt;code&gt;3&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Final Structure of the List
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;After inserting 10, 20, and 30:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The head points to the node with &lt;code&gt;data: 10&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The node with &lt;code&gt;data: 10&lt;/code&gt; points to the node with &lt;code&gt;data: 20&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The node with &lt;code&gt;data: 20&lt;/code&gt; points to the node with &lt;code&gt;data: 30&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The node with &lt;code&gt;data: 30&lt;/code&gt; has next: null, marking it as the last node in the list.&lt;br&gt;
This forms the linked list: &lt;code&gt;10 -&amp;gt; 20 -&amp;gt; 30 -&amp;gt; null&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Output
&lt;/h4&gt;

&lt;p&gt;The final structure of the list will be:&lt;/p&gt;

&lt;p&gt;The head points to the node with &lt;code&gt;data: 10&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 10&lt;/code&gt; points to the node with &lt;code&gt;data: 20&lt;/code&gt;, and the node with &lt;code&gt;data: 20&lt;/code&gt; points to the node with &lt;code&gt;data: 30&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 30&lt;/code&gt; has &lt;code&gt;next: null&lt;/code&gt;, indicating the end of the list.&lt;br&gt;
The list size is &lt;code&gt;3&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Insert at a specific position
&lt;/h3&gt;

&lt;p&gt;Let's talk about Insert at a specific position&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;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// Insert at the beginning&lt;/span&gt;
  &lt;span class="c1"&gt;//insertAtBeginning... method &lt;/span&gt;

  &lt;span class="c1"&gt;// Insert at the end&lt;/span&gt;
  &lt;span class="c1"&gt;//insertAtEnd... method&lt;/span&gt;

  &lt;span class="c1"&gt;// Insert at a specific index&lt;/span&gt;
  &lt;span class="nf"&gt;insertAtIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Invalid index&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Insert at the head&lt;/span&gt;
      &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;previous&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

      &lt;span class="c1"&gt;// Traverse to the desired index&lt;/span&gt;
      &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;previous&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="c1"&gt;// Insert the new node between previous and current&lt;/span&gt;
      &lt;span class="nx"&gt;previous&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c1"&gt;// Example Usage:&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Insert at index&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;insertAtIndex()&lt;/code&gt; Method Explanation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;A new node is created using the &lt;code&gt;Node&lt;/code&gt;class with the given data. The &lt;code&gt;next&lt;/code&gt;pointer of the new node is initially set to &lt;code&gt;null&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If no &lt;code&gt;index&lt;/code&gt;is passed (i.e., &lt;code&gt;index === undefined&lt;/code&gt;), the method logs an error message: "Please provide the index to a specific position" and returns immediately. This ensures that the method doesn't proceed without a valid index, preventing unintended behavior.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The method checks if the given &lt;code&gt;index&lt;/code&gt;is valid:&lt;br&gt;
If the &lt;code&gt;index&lt;/code&gt;is less than &lt;code&gt;0&lt;/code&gt; or greater than the current size of the list, it logs an error message ("Invalid index") and exits the method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the &lt;code&gt;index&lt;/code&gt;is &lt;code&gt;0&lt;/code&gt;, the new node is inserted at the beginning of the list:&lt;br&gt;
The &lt;code&gt;next&lt;/code&gt;pointer of the new node is set to the current &lt;code&gt;head&lt;/code&gt;of the list.&lt;br&gt;
The &lt;code&gt;head&lt;/code&gt;is updated to point to the new node, making it the first node in the list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the &lt;code&gt;index&lt;/code&gt;is greater than &lt;code&gt;0&lt;/code&gt;, the list is traversed to find the node at the desired index:&lt;br&gt;
The method starts at the &lt;code&gt;head&lt;/code&gt;and moves through the list until it reaches the position just before the specified &lt;code&gt;index&lt;/code&gt;.&lt;br&gt;
It keeps track of the &lt;code&gt;previous&lt;/code&gt;node and the &lt;code&gt;current&lt;/code&gt;node during the traversal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the correct position is reached:&lt;br&gt;
The &lt;code&gt;next&lt;/code&gt;pointer of the &lt;code&gt;previous&lt;/code&gt;node is updated to point to the new node.&lt;br&gt;
The &lt;code&gt;next&lt;/code&gt;pointer of the new node is set to the &lt;code&gt;current&lt;/code&gt;node, placing the new node between the &lt;code&gt;previous&lt;/code&gt;and &lt;code&gt;current&lt;/code&gt;nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The size of the list is increased by 1 after the insertion.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  What Happens During Execution
&lt;/h4&gt;

&lt;p&gt;Let's say you have an initial list: &lt;code&gt;head -&amp;gt; 10 -&amp;gt; 20 -&amp;gt; 30&lt;/code&gt;.&lt;br&gt;
You want to insert the value &lt;code&gt;15&lt;/code&gt; at index &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Index Validation: The method checks if index &lt;code&gt;1&lt;/code&gt; is valid (which it is, because the size of the list is currently &lt;code&gt;3&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Node Creation: A new node is created with &lt;code&gt;data: 15&lt;/code&gt; and &lt;code&gt;next: null&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inserting at Index: Since the index is not &lt;code&gt;0&lt;/code&gt;, the method traverses the list to the desired position:&lt;br&gt;
Starts at the &lt;code&gt;head&lt;/code&gt;(node with data &lt;code&gt;10&lt;/code&gt;).&lt;br&gt;
After one iteration, &lt;code&gt;previous&lt;/code&gt;points to &lt;code&gt;10&lt;/code&gt;, and &lt;code&gt;current&lt;/code&gt;points to &lt;code&gt;20&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Insertion: The new node is inserted between the &lt;code&gt;10&lt;/code&gt;node and the &lt;code&gt;20&lt;/code&gt;node:&lt;br&gt;
The &lt;code&gt;next&lt;/code&gt;pointer of the &lt;code&gt;previous&lt;/code&gt;node (&lt;code&gt;10&lt;/code&gt;) is updated to point to the new node (&lt;code&gt;15&lt;/code&gt;).&lt;br&gt;
The &lt;code&gt;next&lt;/code&gt;pointer of the new node is updated to point to the &lt;code&gt;current&lt;/code&gt;node (&lt;code&gt;20&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Size Update: The size of the list is increased by 1.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Final Structure of the List
&lt;/h4&gt;

&lt;p&gt;After inserting &lt;code&gt;15&lt;/code&gt;at index &lt;code&gt;1&lt;/code&gt; into the list &lt;code&gt;head -&amp;gt; 10 -&amp;gt; 20 -&amp;gt; 30&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;The head points to the node with &lt;code&gt;data: 10&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 10&lt;/code&gt; points to the node with &lt;code&gt;data: 15&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 15&lt;/code&gt; points to the node with &lt;code&gt;data: 20&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 20&lt;/code&gt; points to the node with &lt;code&gt;data: 30&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 30&lt;/code&gt; has &lt;code&gt;next: null&lt;/code&gt;, marking the end of the list.&lt;br&gt;
The linked list will now look like this:&lt;br&gt;
&lt;code&gt;10 -&amp;gt; 15 -&amp;gt; 20 -&amp;gt; 30 -&amp;gt; null&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Output
&lt;/h4&gt;

&lt;p&gt;The final structure of the list will be:&lt;/p&gt;

&lt;p&gt;The head points to the node with&lt;code&gt;data: 10&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 10&lt;/code&gt; points to the node with &lt;code&gt;data: 15&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 15&lt;/code&gt; points to the node with &lt;code&gt;data: 20&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 20&lt;/code&gt; points to the node with &lt;code&gt;data: 30&lt;/code&gt;.&lt;br&gt;
The node with &lt;code&gt;data: 30&lt;/code&gt; has &lt;code&gt;next: null&lt;/code&gt;, indicating the end of the list.&lt;br&gt;
The list size is now &lt;code&gt;4&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deletion:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Delete from the beginning
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Insert at the beginning&lt;/span&gt;
  &lt;span class="c1"&gt;//insertAtBeginning... method &lt;/span&gt;

  &lt;span class="c1"&gt;// Insert at the end&lt;/span&gt;
  &lt;span class="c1"&gt;//insertAtEnd... method&lt;/span&gt;

  &lt;span class="c1"&gt;// Insert at a specific index&lt;/span&gt;
  &lt;span class="c1"&gt;//insertAtIndex... method&lt;/span&gt;

  &lt;span class="c1"&gt;// Delete the first node&lt;/span&gt;
  &lt;span class="nf"&gt;deleteFirst&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// If list is empty&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Move head to the next node&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Example Usage:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SinglyLinkedList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Insert at the beginning&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtBeginning&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Insert at the end&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertAtEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


&lt;span class="c1"&gt;// Delete operations&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deleteFirst&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  deleteFirst() Method Explanation
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; The &lt;code&gt;deleteFirst()&lt;/code&gt; method removes the first node (or "head") from the linked list. It’s a common operation in linked lists for cases where you want to delete the starting element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Check if the List is Empty:&lt;br&gt;
The method first checks if &lt;code&gt;this.head&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;, meaning the list is empty. If so, it returns &lt;code&gt;null&lt;/code&gt;immediately since there's nothing to delete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Move the Head Pointer:&lt;br&gt;
If the list is not empty, it updates the &lt;code&gt;head&lt;/code&gt;pointer to point to the next node in the list (&lt;code&gt;this.head.next&lt;/code&gt;). This effectively "removes" the first node because &lt;code&gt;head&lt;/code&gt;now points to the second node.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Decrease the Size:&lt;br&gt;
After removing the first node, the &lt;code&gt;size&lt;/code&gt;property of the list is decreased by 1, keeping track of the updated list length.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  What Happens During Execution
&lt;/h4&gt;

&lt;p&gt;Let's say we have the following list initially:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;head -&amp;gt; 10 -&amp;gt; 20 -&amp;gt; 30 -&amp;gt; 40 -&amp;gt; null&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First Deletion (list.deleteFirst()):
The &lt;code&gt;head&lt;/code&gt;is pointing to &lt;code&gt;10&lt;/code&gt;, which is the first node.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code&gt;deleteFirst()&lt;/code&gt; method checks that the list is not empty, then updates &lt;code&gt;head&lt;/code&gt;to point to &lt;code&gt;20&lt;/code&gt;, the next node in the list.&lt;/p&gt;

&lt;p&gt;The node &lt;code&gt;10&lt;/code&gt;is now effectively removed from the list, and the list size decreases by 1.&lt;/p&gt;

&lt;p&gt;Current list structure after first deletion:&lt;br&gt;
&lt;code&gt;head -&amp;gt; 20 -&amp;gt; 30 -&amp;gt; 40 -&amp;gt; null&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Second Deletion (another list.deleteFirst()):&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;head&lt;/code&gt;is now &lt;code&gt;20&lt;/code&gt;, so the method updates &lt;code&gt;head&lt;/code&gt;to &lt;code&gt;30&lt;/code&gt;, removing &lt;code&gt;20&lt;/code&gt;from the list.&lt;/p&gt;

&lt;p&gt;The list size decreases by another 1.&lt;/p&gt;

&lt;p&gt;Current list structure after second deletion:&lt;br&gt;
&lt;code&gt;head -&amp;gt; 30 -&amp;gt; 40 -&amp;gt; null&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Final Structure of the List
&lt;/h4&gt;

&lt;p&gt;If the initial list was &lt;code&gt;10 -&amp;gt; 20 -&amp;gt; 30 -&amp;gt; 40 -&amp;gt; null&lt;/code&gt;, after two &lt;code&gt;deleteFirst()&lt;/code&gt; calls, the list structure is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;head -&amp;gt; 30 -&amp;gt; 40 -&amp;gt; null&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Output
&lt;/h4&gt;

&lt;p&gt;After calling &lt;code&gt;deleteFirst()&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;The list no longer contains the first node of the original list.&lt;br&gt;
The &lt;code&gt;head&lt;/code&gt;points to the new first node after each deletion.&lt;br&gt;
The &lt;code&gt;size&lt;/code&gt;property accurately reflects the new list length.&lt;/p&gt;

&lt;p&gt;If any more calls to deleteFirst() are made until the list is empty, head will eventually become null.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coming soon...
&lt;/h2&gt;

</description>
      <category>dsa</category>
      <category>javascript</category>
      <category>algorithms</category>
      <category>datastructures</category>
    </item>
    <item>
      <title>Data Structures &amp; Algorithm Day 0</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Sat, 05 Oct 2024 19:07:34 +0000</pubDate>
      <link>https://dev.to/robiulman/data-structures-algorithm-day-0-138m</link>
      <guid>https://dev.to/robiulman/data-structures-algorithm-day-0-138m</guid>
      <description>&lt;h2&gt;
  
  
  Day 0
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Basic data structures
&lt;/h3&gt;

&lt;p&gt;We will see all the code examples in javascript but these concepts are not language-agnostic&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Arrays&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An array is a collection of elements, typically of the same type, stored in contiguous memory locations.&lt;/p&gt;

&lt;p&gt;Array as a List of Books:&lt;br&gt;
Imagine you have a shelf that holds a specific number of books. Each slot on the shelf is like an index in an array, and each book is like the element stored at that index.&lt;/p&gt;

&lt;p&gt;Key Characteristics:&lt;/p&gt;

&lt;p&gt;Indexing: Each element can be accessed by its index (0-based or 1-based depending on the language).&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;fruit&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Banana&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Grape&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Pineapple&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="nx"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;//  Banana is accessed 0 index&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;fruit&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;// Pineapple is accessed 3 index&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fixed-size: Once declared, the size of the array cannot change (static arrays).&lt;br&gt;
In languages with static arrays, when you declare an array, you must specify its size at the time of creation. This means that if you declare an array with a size of 5, you can only store 5 elements in it, and the size cannot be changed later. You can't add more elements once the array is full, nor can you shrink it.&lt;/p&gt;

&lt;p&gt;However, JavaScript arrays are dynamic by nature, so you don't have this fixed-size limitation in most cases. But to understand fixed-size arrays conceptually, imagine if JavaScript arrays couldn't grow or shrink.&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;fixedArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Array with a fixed size of 3&lt;/span&gt;
&lt;span class="nx"&gt;fixedArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;fixedArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;banana&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;fixedArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cherry&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Now if you try to add another item:&lt;/span&gt;
&lt;span class="nx"&gt;fixedArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;date&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// This would throw an error or overwrite an existing element (hypothetically)&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;fixedArray&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [ 'apple', 'banana', 'cherry', 'date' ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Random access: You can access any element directly using its index.&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;fruit&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Banana&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Grape&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Pineapple&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="nx"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;// index 0 is the Banana &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;fruit&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;// index 3 is the Pineapple &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fast access to elements by index (O(1) time complexity).&lt;/li&gt;
&lt;li&gt;Simple to implement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Insertion and deletion are expensive (O(n) time complexity) because shifting elements may be necessary.&lt;/li&gt;
&lt;li&gt;Fixed-size (in some languages), making it less flexible.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dsa</category>
      <category>datastructures</category>
      <category>algorithms</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Github copilot setup on Austronvim</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Sun, 22 Sep 2024 09:25:14 +0000</pubDate>
      <link>https://dev.to/robiulman/github-copilot-setup-on-austronvim-i2j</link>
      <guid>https://dev.to/robiulman/github-copilot-setup-on-austronvim-i2j</guid>
      <description>&lt;p&gt;I got in trouble while configuring GitHub copilot on Austronvim into windows os.&lt;/p&gt;

&lt;p&gt;Follow these instruction to config should be worked&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;C:&lt;span class="se"&gt;\U&lt;/span&gt;sers&lt;span class="se"&gt;\Y&lt;/span&gt;OUR_USER&lt;span class="se"&gt;\A&lt;/span&gt;ppData&lt;span class="se"&gt;\L&lt;/span&gt;ocal&lt;span class="se"&gt;\n&lt;/span&gt;vim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create a file into plugins/completions.lua&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"github/copilot.vim"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;close the file and reopen then follow these instructions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;:Copilot setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;:Copilot auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now it's ready to use.&lt;/p&gt;

</description>
      <category>vim</category>
      <category>githubcopilot</category>
      <category>neovim</category>
    </item>
    <item>
      <title>next.js 14 server action, API route vs separate backend</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Wed, 12 Jun 2024 08:54:33 +0000</pubDate>
      <link>https://dev.to/robiulman/nextjs-14-server-action-api-route-vs-separate-backend-4266</link>
      <guid>https://dev.to/robiulman/nextjs-14-server-action-api-route-vs-separate-backend-4266</guid>
      <description>&lt;h3&gt;
  
  
  Next.js API Routes in Next.js 14:
&lt;/h3&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Simplicity:&lt;/li&gt;
&lt;li&gt;Unified Codebase:&lt;/li&gt;
&lt;li&gt;Serverless Architecture:&lt;/li&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Limited Flexibility:&lt;/li&gt;
&lt;li&gt;Vendor Lock-in:&lt;/li&gt;
&lt;li&gt;Scalability Concerns:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;In Next.js 14, API routes have been rewritten using React Server Components, which provide a more efficient and streamlined approach to handling server-side rendering (SSR) and server-side operations.&lt;/li&gt;
&lt;li&gt;API routes can now leverage the new Server Actions feature, which allows you to write server-side code directly within your React components, making it easier to integrate server-side logic with the frontend.&lt;/li&gt;
&lt;li&gt;With Server Actions, you can perform server-side operations like querying databases, interacting with APIs, or processing data, all within the same component file.&lt;/li&gt;
&lt;li&gt;The new architecture in Next.js 14 improves performance and reduces the overhead of server-client communication by minimizing the need for client-side JavaScript and allowing for more efficient rendering on the server.&lt;/li&gt;
&lt;li&gt;API routes and Server Actions are well-suited for handling lightweight to moderate server-side operations and can leverage the benefits of Next.js's built-in features like static generation, server-side rendering, and middleware.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Separate Backend (Express, Django, Spring, etc.):
&lt;/h3&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Flexibility:&lt;/li&gt;
&lt;li&gt;Scalability:&lt;/li&gt;
&lt;li&gt;Specialized Frameworks:&lt;/li&gt;
&lt;li&gt;Security and Compliance:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Increased Complexity:&lt;/li&gt;
&lt;li&gt;Deployment and Infrastructure:&lt;/li&gt;
&lt;li&gt;Latency:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Using a separate backend application built with frameworks like Express, Django, or Spring is still a viable option in Next.js 14, especially for applications with complex server-side requirements or when you need to leverage the full capabilities of a dedicated server-side framework.&lt;/li&gt;
&lt;li&gt;A separate backend allows for better separation of concerns, scalability, and flexibility in choosing the appropriate technology stack for the backend.&lt;/li&gt;
&lt;li&gt;Complex server-side operations like real-time communication (WebSockets), background jobs, and advanced database operations can be more easily implemented and managed within a dedicated backend application.&lt;/li&gt;
&lt;li&gt;With a separate backend, you have more control over server-side caching, load balancing, and horizontal scaling, which may be necessary for highly scalable and resource-intensive applications.&lt;/li&gt;
&lt;li&gt;However, using a separate backend introduces additional complexity in setting up and managing two separate applications (frontend and backend), as well as potential challenges in integrating the frontend and backend, such as handling CORS and authentication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Next.js 14, the decision between using Next.js API routes with Server Actions or a separate backend largely depends on the complexity of your application's server-side requirements and the expertise of your development team.&lt;/p&gt;

&lt;p&gt;If your application has relatively simple to moderate server-side operations and can leverage the benefits of Next.js's built-in features, using Next.js API routes and Server Actions can provide a more streamlined and efficient development experience, with better integration between the frontend and backend.&lt;/p&gt;

&lt;p&gt;On the other hand, if your application requires complex server-side logic, advanced server-side features, or if you need to leverage the full capabilities of a dedicated server-side framework, using a separate backend application may be the better choice. This approach allows for better scalability, flexibility, and separation of concerns, but at the cost of increased complexity in setup, deployment, and integration.&lt;/p&gt;

&lt;p&gt;It's also worth noting that you can adopt a hybrid approach, where you use Next.js API routes and Server Actions for lightweight operations, while offloading more complex server-side logic to a separate backend application. This allows you to leverage the benefits of both architectures and mitigate their limitations based on your application's specific needs.&lt;/p&gt;

&lt;p&gt;Ultimately, the decision should be based on a careful evaluation of your application's requirements, the complexity of your server-side operations, the expertise of your development team, and the scalability and performance demands of your project.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>backend</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Did Kafka Just Get Easier?</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Thu, 16 May 2024 06:23:09 +0000</pubDate>
      <link>https://dev.to/robiulman/did-kafka-just-get-easier-4hm4</link>
      <guid>https://dev.to/robiulman/did-kafka-just-get-easier-4hm4</guid>
      <description>&lt;p&gt;&lt;strong&gt;credit goes: Mayank Ahuja [in/curiouslearner/]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;'Apache Kafka Without ZooKeeper - Using KRaft' (Give it a read.)👇&lt;/p&gt;

&lt;h2&gt;
  
  
  𝐒𝐨𝐦𝐞 𝐁𝐚𝐜𝐤𝐠𝐫𝐨𝐮𝐧𝐝 -
&lt;/h2&gt;

&lt;p&gt;◾ Apache Kafka is a distributed streaming platform designed for high-throughput, fault-tolerant data pipelines.&lt;br&gt;
◾ It enables real-time data processing, event-driven architectures and reliable messaging.&lt;br&gt;
◾ Kafka's architecture originally relied on ZooKeeper, an external coordination service.&lt;/p&gt;

&lt;h2&gt;
  
  
  📌 𝐖𝐡𝐚𝐭 𝐰𝐚𝐬 𝐙𝐨𝐨𝐤𝐞𝐞𝐩𝐞𝐫'𝐬 𝐫𝐨𝐥𝐞?
&lt;/h2&gt;

&lt;p&gt;◾ Cluster Metadata Management ✔&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stored information about brokers, topics, partitions and their configurations.&lt;/li&gt;
&lt;li&gt;Maintained cluster membership and facilitated broker discovery.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;◾ Controller Functionality ✔&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Elected a leader broker (Controller) responsible for managing cluster operations (e.g., partition reassignment, leader election).&lt;/li&gt;
&lt;li&gt;Relied heavily on ZooKeeper for metadata updates and coordination.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📌 𝐋𝐞𝐭'𝐬 𝐚𝐥𝐬𝐨 𝐭𝐚𝐥𝐤 𝐚𝐛𝐨𝐮𝐭 𝐬𝐨𝐦𝐞 𝐜𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞𝐬.
&lt;/h2&gt;

&lt;p&gt;◾ External Dependency&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Required separate deployment and management of ZooKeeper.&lt;/li&gt;
&lt;li&gt;Increased operational complexity and potential points of failure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;◾ Scalability Limitations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ZooKeeper could become a bottleneck for large-scale clusters due to metadata management overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;◾ Operational Overhead&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintaining a ZooKeeper ensemble added administrative burdens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;𝐒𝐨 𝐟𝐢𝐧𝐚𝐥𝐥𝐲,&lt;/p&gt;

&lt;p&gt;Apache Kafka Raft (KRaft), a consensus protocol introduced in KIP-500 to eliminate Kafka's reliance on ZooKeeper.&lt;/p&gt;

&lt;p&gt;** KIP-500 =&amp;gt; Kafka Improvement Proposal 500&lt;/p&gt;

&lt;h2&gt;
  
  
  📌 𝐇𝐨𝐰 𝐢𝐭 𝐰𝐨𝐫𝐤𝐬? (Kafka with KRaft)
&lt;/h2&gt;

&lt;p&gt;◾ With KRaft, Kafka now manages its own metadata through a 'metadata quorum' of brokers.&lt;/p&gt;

&lt;p&gt;◾ These brokers utilize the Raft consensus protocol to ensure data consistency and availability, removing the need for ZooKeeper.&lt;/p&gt;

&lt;p&gt;◾ Cluster metadata is stored in a dedicated, internal Kafka topic called '__cluster_metadata'.&lt;/p&gt;

&lt;p&gt;◾ This topic is replicated across the metadata quorum, ensuring that metadata changes are durable and available even if some brokers fail.&lt;/p&gt;

&lt;p&gt;◾ The Kafka Controller, responsible for various cluster management tasks like partition reassignment and leader election, is elected as a leader among the metadata quorum brokers.&lt;/p&gt;

&lt;p&gt;◾ Only the leader Controller can modify the metadata. This ensures that metadata changes are serialized and prevents conflicts.&lt;/p&gt;

&lt;p&gt;◾ Whenever metadata changes, the leader Controller appends the changes to the internal '__cluster_metadata' topic.&lt;/p&gt;

&lt;p&gt;◾ Other brokers in the quorum follow the leader's decisions and replicate metadata changes.&lt;/p&gt;

&lt;p&gt;◾ If the current leader fails, a new leader is elected automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  𝐖𝐡𝐢𝐜𝐡 𝐦𝐞𝐚𝐧𝐬,
&lt;/h2&gt;

&lt;p&gt;✔ Simplified architecture.&lt;br&gt;
✔ Improved scalability.&lt;br&gt;
✔ Reduced operational overhead.&lt;br&gt;
✔ Enhanced stability and performance.&lt;/p&gt;

&lt;p&gt;📌 Support for ZooKeeper was deprecated in Kafka 3.4, encouraging users to migrate to KRaft.&lt;/p&gt;

&lt;p&gt;📌 ZooKeeper support is expected to be removed entirely in a future Kafka release.&lt;/p&gt;

&lt;p&gt;⭐ Follow &lt;a href="https://www.linkedin.com/in/curiouslearner/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/curiouslearner/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kafka</category>
      <category>webdev</category>
      <category>backend</category>
      <category>devops</category>
    </item>
    <item>
      <title>Next.js 14 Server Actions and API Routes</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Mon, 13 May 2024 07:26:44 +0000</pubDate>
      <link>https://dev.to/robiulman/nextjs-14-server-actions-and-api-routes-1c35</link>
      <guid>https://dev.to/robiulman/nextjs-14-server-actions-and-api-routes-1c35</guid>
      <description>&lt;p&gt;In Next.js, there are two main approaches to handle data fetching: Server Actions and API Routes. Both have their advantages and use cases, and the choice depends on your specific requirements and constraints.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server Actions:
&lt;/h2&gt;

&lt;p&gt;**Server Actions are a new feature introduced in Next.js 13, designed to handle server-side operations and data fetching directly from a React component. They are meant to replace traditional API routes for certain use cases.&lt;br&gt;
Advantages of Server Actions:&lt;/p&gt;

&lt;p&gt;Tighter integration with React components: Server Actions are defined within React components, allowing for a more cohesive and organized codebase.&lt;br&gt;
Simplified data fetching: With Server Actions, you can directly import and use server-side logic and utilities within your React components, eliminating the need for separate API routes.&lt;br&gt;
Improved developer experience: Server Actions provide a more streamlined developer experience by removing the need to switch between client and server contexts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases for Server Actions:
&lt;/h2&gt;

&lt;p&gt;Simple data fetching operations&lt;br&gt;
Form submissions&lt;br&gt;
User authentication and authorization&lt;br&gt;
Handling sensitive data or operations that should not be exposed through public API routes&lt;/p&gt;

&lt;h2&gt;
  
  
  API Routes:
&lt;/h2&gt;

&lt;p&gt;API Routes are a well-established feature in Next.js that allows you to create server-side API endpoints within your application.&lt;br&gt;
Advantages of API Routes:&lt;/p&gt;

&lt;p&gt;Separation of concerns: API Routes separate the server-side logic from the client-side React components, promoting a more modular and maintainable codebase.&lt;br&gt;
Flexibility: API Routes can handle a wide range of use cases, from simple data fetching to complex server-side operations and integrations with third-party services.&lt;br&gt;
Reusability: API Routes can be consumed not only by your Next.js application but also by other clients or services, making them more versatile and reusable.&lt;br&gt;
Scalability: API Routes can be easily scaled and deployed independently from the client-side application, allowing for more efficient resource allocation and scaling strategies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases for API Routes:
&lt;/h2&gt;

&lt;p&gt;Complex data fetching and manipulation operations&lt;br&gt;
Integrations with external APIs or services&lt;br&gt;
Handling sensitive data or operations that should be isolated from the client-side code&lt;br&gt;
Exposing a public API for third-party clients or services&lt;/p&gt;

&lt;p&gt;In general, if you have simple data fetching requirements and operations that are tightly coupled with your React components, Server Actions can be a more convenient and streamlined approach. However, if you have more complex data fetching and server-side operations, or if you need to expose a public API for third-party clients or services, API Routes might be a better choice.&lt;br&gt;
Ultimately, the decision between Server Actions and API Routes depends on your specific use case, the complexity of your data fetching operations, and your team's preferences and familiarity with either approach.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>nextjs</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Next.js Failed to compile Deploying to Vercel</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Sun, 05 May 2024 20:32:27 +0000</pubDate>
      <link>https://dev.to/robiulman/nextjs-failed-to-compile-deploying-to-vercel-23al</link>
      <guid>https://dev.to/robiulman/nextjs-failed-to-compile-deploying-to-vercel-23al</guid>
      <description>&lt;p&gt;If you are getting the errors below while deploying on Vercel.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Error:&lt;/code&gt;”&lt;code&gt;can be escaped with&lt;/code&gt;"&lt;code&gt;,&lt;/code&gt;“&lt;code&gt;,&lt;/code&gt;"&lt;code&gt;,&lt;/code&gt;”&lt;code&gt;. react/no-unescaped-entities&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If any JSX files have some of the text with “ or ‘. that file linter shows errors.&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;Example&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&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="o"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  &lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;up&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="nx"&gt;drops&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;behind&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;the&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;scenes&lt;/span&gt; 
          &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;monthly&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5 Things I'm Digging&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;emails&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&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="p"&gt;)}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Example&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can solve this issue with several options:&lt;/p&gt;

&lt;p&gt;Bad practice: Remember don’t suppress linter like 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="c1"&gt;//eslint.json&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rules&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react/no-unescaped-entities&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good Practice: Escape HTML or {} Embedding Expressions with  Template literals wrap in JSX.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/html/html_entities.asp" rel="noopener noreferrer"&gt;List of the Escape HTML Characters.&lt;/a&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;const&lt;/span&gt; &lt;span class="nx"&gt;Example&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&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="o"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  &lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;up&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="nx"&gt;drops&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;behind&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;the&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;scenes&lt;/span&gt; 
          &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;monthly&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`"5 Things I'm Digging"`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;emails&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&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="p"&gt;)}&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Example&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&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;Example&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&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="o"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  &lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;up&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="nx"&gt;drops&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;behind&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;the&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;scenes&lt;/span&gt; 
          &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;monthly&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;quot&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="nx"&gt;Things&lt;/span&gt; &lt;span class="nx"&gt;I&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;apos&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="nx"&gt;Digging&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;quot&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;emails&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&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="p"&gt;)}&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Example&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Warning: Current Server Discovery and Monitoring engine</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Thu, 23 Jun 2022 20:34:38 +0000</pubDate>
      <link>https://dev.to/robiulman/warning-current-server-discovery-and-monitoring-engine-56mm</link>
      <guid>https://dev.to/robiulman/warning-current-server-discovery-and-monitoring-engine-56mm</guid>
      <description>&lt;p&gt;[MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using the Winston to write the MongoDB logger. we have to pass everything which is required for MongoDB. &lt;br&gt;
If we mistake anything it will make an error&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you use your project Winston logger and you did not pass options into the Winston transport that's why you get the error.&lt;/p&gt;

&lt;p&gt;Following this.&lt;br&gt;
The error will be gone.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;winston.add(new winston.transports.MongoDB({
    db: 'mongodb://localhost:27017/',
    options: {
        useUnifiedTopology: true,
    }
}));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>mongodb</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>become a Blockchain Developer</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Fri, 22 Oct 2021 13:53:58 +0000</pubDate>
      <link>https://dev.to/robiulman/become-a-blockchain-developer-1i8a</link>
      <guid>https://dev.to/robiulman/become-a-blockchain-developer-1i8a</guid>
      <description>&lt;p&gt;Credit goes to: &lt;a href="https://www.reddit.com/user/SolorMining/" rel="noopener noreferrer"&gt;SolorMining&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to become a Crypto/Blockchain Developer? Here is a list of Free Educational Courses with Free Credentials - on Blockchain, Programming, Software Engineering and more.&lt;/p&gt;

&lt;p&gt;For those looking to get into becoming a Blockchain and CryptoCurrency Developer, I have put together a list of Free Courses to help you get started along your journey.&lt;/p&gt;

&lt;p&gt;We can always use more Developers!&lt;/p&gt;

&lt;p&gt;The list of Free material consists of courses from Saylor Academy, IBM, The Linux Foundation, Cisco, Texas A&amp;amp;M, and others. All Free to take, and all offering some sort of Free Certification or Digital Badge upon completion. Not only are these great Free learning resources from known and reputable sources, but they also come with sharable proof that you learned them :)&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%2Fntnkl5y5plea0r8bepw2.jpg" 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%2Fntnkl5y5plea0r8bepw2.jpg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Computer Science💻
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=6" rel="noopener noreferrer"&gt;CS101: Introduction to Computer Science I (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=64" rel="noopener noreferrer"&gt;CS102: Introduction to Computer Science II (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=439" rel="noopener noreferrer"&gt;CS105: Introduction to Python (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=66" rel="noopener noreferrer"&gt;CS107: C++ Programming (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=66" rel="noopener noreferrer"&gt;CS201: Elementary Data Structures (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=67" rel="noopener noreferrer"&gt;CS202: Discrete Structures (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=71" rel="noopener noreferrer"&gt;CS301: Computer Architecture (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=73" rel="noopener noreferrer"&gt;CS302: Software Engineering (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR178" rel="noopener noreferrer"&gt;AWR178 Secure Software (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=94" rel="noopener noreferrer"&gt;CS401: Operating Systems (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=93" rel="noopener noreferrer"&gt;CS403: Introduction to Modern Database Systems (Saylor Academy)&lt;/a&gt;&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%2Fmposeedhyoa2pb8u23wz.jpg" 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%2Fmposeedhyoa2pb8u23wz.jpg" alt="Image description" width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Blockchain / CryptoCurrency
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=468" rel="noopener noreferrer"&gt;Bitcoin for Everybody (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cognitiveclass.ai/courses/blockchain-course" rel="noopener noreferrer"&gt;Blockchain Essentials (IBM)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.unic.ac.cy/blockchain/free-mooc/" rel="noopener noreferrer"&gt;DFIN 511: Introduction to Digital Currencies (UNIC) (Starts Dept 27th)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cognitiveclass.ai/courses/ibm-blockchain-foundation-dev" rel="noopener noreferrer"&gt;Blockchain Foundation Developer (IBM)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cognitiveclass.ai/courses/blockchain-iot-node-red-food-network/" rel="noopener noreferrer"&gt;Build an IoT Blockchain Network for a Supply Chain (IBM)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bitdegree.org/course/learn-solidity-space-doggos" rel="noopener noreferrer"&gt;Learn Solidity with Space Doggo (BitDegree)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cryptozombies.io/" rel="noopener noreferrer"&gt;Solidity Tutorial &amp;amp; Ethereum Blockchain Programming Course (Crypto Zombies)&lt;/a&gt;&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%2F8e9j28fukugmix21rhvj.jpg" 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%2F8e9j28fukugmix21rhvj.jpg" alt="Image description" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Source Development
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.bitdegree.org/course/git-tutorial-for-beginners" rel="noopener noreferrer"&gt;Git Tutorial For Beginners: Git Tutorial for Beginners: Master Version Control (BitDegree)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/beginners-guide-open-source-software-development/" rel="noopener noreferrer"&gt;A Beginner’s Guide to Open Source Software Development (Linux Foundation)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bitdegree.org/course/linux-tutorial" rel="noopener noreferrer"&gt;Absolute Guide: Linux Tutorial for Beginners (BitDegree)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/a-beginners-guide-to-linux-kernel-development-lfd103/" rel="noopener noreferrer"&gt;A Beginner’s Guide to Linux Kernel Development (Linux Foundation)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/open-source-licensing-basics-for-software-developers/" rel="noopener noreferrer"&gt;Open Source Licensing Basics for Software Developers (Linux Foundation)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/fundamentals-of-professional-open-source-management/" rel="noopener noreferrer"&gt;Fundamentals of Professional Open Source Management (Linux Foundation)&lt;/a&gt;&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%2F6u8n4fblq90831o07och.jpg" 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%2F6u8n4fblq90831o07och.jpg" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  BONUS: Networking &amp;amp; CyberSecurity
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR173" rel="noopener noreferrer"&gt;AWR173 Information Security Basics (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.netacad.com/courses/networking/networking-essentials" rel="noopener noreferrer"&gt;Networking Essentials (Cisco NetAcad)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.netacad.com/courses/packet-tracer/introduction-packet-tracer" rel="noopener noreferrer"&gt;Introduction to Packet Tracer (Cisco NetAcad)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=84" rel="noopener noreferrer"&gt;CS402: Computer Communications and Networks (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.netacad.com/courses/iot/introduction-iot" rel="noopener noreferrer"&gt;Introduction to IoT (Cisco NetAcad)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.netacad.com/courses/cybersecurity/introduction-cybersecurity" rel="noopener noreferrer"&gt;Introduction to CyberSecurity (Cisco NetAcad)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=453" rel="noopener noreferrer"&gt;CS:406 Information Security (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR174" rel="noopener noreferrer"&gt;AWR174 Cyber Ethics (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR175" rel="noopener noreferrer"&gt;AWR175 Information Security for Everyone (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR138" rel="noopener noreferrer"&gt;AWR138 Network Assurance (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR139" rel="noopener noreferrer"&gt;AWR139 Digital Forensics Basics (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.netacad.com/courses/cybersecurity/cybersecurity-essentials" rel="noopener noreferrer"&gt;CyberSecurity Essentials (Cisco NetAcad)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR168" rel="noopener noreferrer"&gt;AWR168 Cyber Law and White Collar Crime (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR169" rel="noopener noreferrer"&gt;AWR169 Cyber Incident Analysis and Response (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR176" rel="noopener noreferrer"&gt;AWR176 Disaster Recovery for Information Systems (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR177" rel="noopener noreferrer"&gt;AWR177 Information Risk Management (Texas A&amp;amp;M)&lt;/a&gt;&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%2F7ktw3rqi08wt8k5h4xnj.jpg" 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%2F7ktw3rqi08wt8k5h4xnj.jpg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2ND BONUS: Math
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=24" rel="noopener noreferrer"&gt;MA001: College Algebra (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=25" rel="noopener noreferrer"&gt;MA005: Calculus I (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=28" rel="noopener noreferrer"&gt;MA121: Introduction to Statistics (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR177" rel="noopener noreferrer"&gt;Mathematical Optimization for Business Problems (IBM)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please feel free to add additional resources in the comments. I will add them to the main post if they fit the criteria of being free and providing proof of completion.&lt;/p&gt;

&lt;p&gt;Happy learning friends :)&lt;/p&gt;




&lt;h4&gt;
  
  
  Edit: By request, here is a more streamline curriculum from the courses above, if someone is starting from the very beginning and looking to learn as quickly as possible:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=468" rel="noopener noreferrer"&gt;Bitcoin for Everybody (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cognitiveclass.ai/courses/blockchain-course" rel="noopener noreferrer"&gt;Blockchain Essentials (IBM)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=6" rel="noopener noreferrer"&gt;CS101: Introduction to Computer Science I (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=64" rel="noopener noreferrer"&gt;CS102: Introduction to Computer Science II (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=66" rel="noopener noreferrer"&gt;CS201: Elementary Data Structures (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=67" rel="noopener noreferrer"&gt;CS202: Discrete Structures (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.saylor.org/course/view.php?id=73" rel="noopener noreferrer"&gt;CS302: Software Engineering (Saylor Academy)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teex.org/class/AWR178" rel="noopener noreferrer"&gt;AWR178 Secure Software (Texas A&amp;amp;M)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cognitiveclass.ai/courses/ibm-blockchain-foundation-dev" rel="noopener noreferrer"&gt;Blockchain Foundation Developer (IBM)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bitdegree.org/course/learn-solidity-space-doggos" rel="noopener noreferrer"&gt;Learn Solidity with Space Doggo (BitDegree)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cryptozombies.io/" rel="noopener noreferrer"&gt;Solidity Tutorial &amp;amp; Ethereum Blockchain Programming Course (Crypto Zombies)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bitdegree.org/course/git-tutorial-for-beginners" rel="noopener noreferrer"&gt;Git Tutorial For Beginners: Git Tutorial for Beginners: Master Version Control (BitDegree)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/beginners-guide-open-source-software-development/" rel="noopener noreferrer"&gt;A Beginner’s Guide to Open Source Software Development (Linux Foundation)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bitdegree.org/course/linux-tutorial" rel="noopener noreferrer"&gt;Absolute Guide: Linux Tutorial for Beginners (BitDegree)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/a-beginners-guide-to-linux-kernel-development-lfd103/" rel="noopener noreferrer"&gt;A Beginner’s Guide to Linux Kernel Development (Linux Foundation)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/open-source-licensing-basics-for-software-developers/" rel="noopener noreferrer"&gt;Open Source Licensing Basics for Software Developers (Linux Foundation)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://training.linuxfoundation.org/training/fundamentals-of-professional-open-source-management/" rel="noopener noreferrer"&gt;Fundamentals of Professional Open Source Management (Linux Foundation)&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>career</category>
      <category>computerscience</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Regex is like an egg</title>
      <dc:creator>Robiul</dc:creator>
      <pubDate>Sat, 03 Jul 2021 12:03:42 +0000</pubDate>
      <link>https://dev.to/robiulman/regex-is-like-an-egg-3gko</link>
      <guid>https://dev.to/robiulman/regex-is-like-an-egg-3gko</guid>
      <description>&lt;h1&gt;
  
  
  Hi my all are dev &amp;amp; tech beautiful friends
&lt;/h1&gt;

&lt;p&gt;you're thinking🤔 why I've written the title of regex is like an egg no worries I'll be explaining that &lt;/p&gt;

&lt;h4&gt;
  
  
  a little bit of introduction of egg  🥚
&lt;/h4&gt;

&lt;p&gt;Both the white and yolk of an egg are rich in nutrients, including proteins, vitamins, and minerals. The yolk also contains cholesterol, fat-soluble vitamins (such as vitamins D and E), and essential fatty acids. Eggs are also an important and versatile ingredient for cooking &lt;strong&gt;wait! ✋ wait!&lt;/strong&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;no worries, it's neither a food article nor I'm a food expert&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;as we know that the egg is very important in our health and the regex is important part of programming language.&lt;/p&gt;

&lt;h3&gt;
  
  
  my meet with regex
&lt;/h3&gt;

&lt;p&gt;as a beginner, we have a lot of confusion about the programming language different concepts include with regex. personally, I had a little bit scared about the regex. that's why I tried to learn as much as possible. and I figured out the regex is how cool is that.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is a Regular Expression?
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;h5&gt;
  
  
  🗣️w3schools says
&lt;/h5&gt;
&lt;/blockquote&gt;

&lt;p&gt;A regular expression is a sequence of characters that forms a search pattern.&lt;/p&gt;

&lt;p&gt;When you search for data in a text, you can use this search pattern to describe what you are searching for.&lt;/p&gt;

&lt;p&gt;A regular expression can be a single character or a more complicated pattern.&lt;/p&gt;

&lt;p&gt;Regular expressions can be used to perform all types of text search and text replace operations.&lt;/p&gt;

&lt;p&gt;It is used in almost all languages like C#, Java, Javascript, To, Python, so on.&lt;/p&gt;

&lt;p&gt;if you want to learn more check out the link below 👇&lt;br&gt;
&lt;a href="https://javascript.info/regular-expressions" rel="noopener noreferrer"&gt;Regular expressions javascript.info&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions" rel="noopener noreferrer"&gt;Regular expressions MDN&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3schools.com/js/js_regexp.asp" rel="noopener noreferrer"&gt;Regular expressions w3schools&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Regular Expression with Java, javaScript, python
&lt;/h3&gt;

&lt;p&gt;in this article I'm not going to be teaching you the Regular Expression.&lt;br&gt;
we would try to explore the regex with problem-solving also understand how does regex work.&lt;br&gt;
I hope it would be better for us to understand the regex.&lt;/p&gt;

&lt;h3&gt;
  
  
  below is the Problem Statement
&lt;/h3&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%2F3gwehokufinjhwx7f5a5.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%2F3gwehokufinjhwx7f5a5.png" alt="blow the Problem Statement" width="800" height="398"&gt;&lt;/a&gt;&lt;br&gt;
in this problem, we can solve several ways but we would solve it with regex.&lt;/p&gt;

&lt;h3&gt;
  
  
  let's do solve with javascript
&lt;/h3&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%2Fxg54wsheombufry09uqr.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%2Fxg54wsheombufry09uqr.png" alt="let's do solve with javascript" width="800" height="279"&gt;&lt;/a&gt;&lt;br&gt;
In the above solution, now we are going to explore what's happening here. at first, we've taken the variable names of &lt;code&gt;zero&lt;/code&gt; and &lt;code&gt;one&lt;/code&gt;  after that InstallShield with regex operation.&lt;br&gt;
&lt;code&gt;s&lt;/code&gt; is an input parameter into our function and &lt;code&gt;match()&lt;/code&gt; is regex method, it takes a parameter likes a regex pattern.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// forward-slash:&lt;/code&gt; in the javascript, we can write regex Pratten Through forward-slash also constructor function, it's calling literal &lt;code&gt;/ab+c/&lt;/code&gt; another it's calling constructor &lt;code&gt;new RegExp('ab+c')&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0+&lt;/code&gt; 0 is our expected value and &lt;code&gt;+&lt;/code&gt; it's calling Quantifiers, The plus sign indicates one or more occurrences of the preceding &lt;code&gt;0&lt;/code&gt; element.&lt;br&gt;
&lt;code&gt;g flag modifier&lt;/code&gt; it means &lt;code&gt;g&lt;/code&gt; is a modifier global flag &lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt;in the javascript If the regex does not include the g modifier (to perform a global search), the &lt;code&gt;match()&lt;/code&gt; method will return only the first match in the string.  &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;match()&lt;/code&gt; method searches a string for a match against a regex, and returns the matches, as an Array object,  returns null if no match is found.&lt;/p&gt;

&lt;p&gt;we got likes this &lt;code&gt;[000]&lt;/code&gt; from &lt;code&gt;zero&lt;/code&gt; and &lt;code&gt;one&lt;/code&gt; &lt;code&gt;[1111]&lt;/code&gt;&lt;br&gt;
as we saw that the &lt;code&gt;match()&lt;/code&gt; method returns null if no match is found. that's why we used after &lt;code&gt;||&lt;/code&gt;or operator it helps to convert the null to the empty array &lt;code&gt;[]&lt;/code&gt; after parentheses to grouping the expression we used &lt;code&gt;join()&lt;/code&gt; method it helps to convert to the string likes this &lt;code&gt;'0000'&lt;/code&gt; and &lt;code&gt;'1111'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;now we explore &lt;code&gt;return&lt;/code&gt; it just returns boolean value because we subtracted with zero and one length inside of math.abs function and meth.abs function return absolute value after that we compared less than or equal 1 or not this’s our solution with regex.&lt;/p&gt;

&lt;h3&gt;
  
  
  below is the Problem Statement
&lt;/h3&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%2Fqwq8cmsa1dhw6ow3x6ba.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%2Fqwq8cmsa1dhw6ow3x6ba.png" alt="blow the Problem Statement" width="800" height="525"&gt;&lt;/a&gt;&lt;br&gt;
as we know, we can solve several ways but we would solve with regex.&lt;/p&gt;

&lt;h3&gt;
  
  
  let's do solve with python
&lt;/h3&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%2Fjbzi0hmlrs8ij0vh0o5l.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%2Fjbzi0hmlrs8ij0vh0o5l.png" alt="let's do solve with python" width="800" height="326"&gt;&lt;/a&gt;&lt;br&gt;
In the above solution. now we are going to explore what's happening here.&lt;br&gt;
in this problem if we want to make any operation with regex we have to import the &lt;code&gt;re&lt;/code&gt; module in python other ways we can't do any operation with regex.&lt;/p&gt;

&lt;p&gt;whatever, at first we've taken the variables name of &lt;code&gt;decoded&lt;/code&gt; after InstallShield with regex method &lt;code&gt;re.findall()&lt;/code&gt;.&lt;br&gt;
&lt;code&gt;findall(pattern, string, flags=0)&lt;/code&gt; method has up to three arguments.&lt;br&gt;
The &lt;code&gt;findall()&lt;/code&gt; is probably the single most powerful function in the re module. &lt;code&gt;findall()&lt;/code&gt; finds *all* the matches and returns them as a list of strings, with each string representing one match.&lt;br&gt;
&lt;strong&gt;note:&lt;/strong&gt; If no matches are found, an empty list is returned.&lt;/p&gt;

&lt;p&gt;then we have used the pattern&lt;code&gt;[a-zA-Z1-9]&lt;/code&gt; &lt;code&gt;a-z&lt;/code&gt; it means given the ipute a to z any alphabetic smil latter and as same as that &lt;code&gt;A-Z&lt;/code&gt;  any alphabetic capital letter also &lt;code&gt;1-9&lt;/code&gt; it means 1 to 9 any number to the match. if we can use flag &lt;code&gt;I&lt;/code&gt; we don't need to mention capital and smail latter.&lt;br&gt;
however, we got this &lt;code&gt;['John', 'Doe', '123']&lt;/code&gt; from decoded as a list now we can easily use with dictionary and we did that.&lt;/p&gt;

&lt;h3&gt;
  
  
  below is the Problem Statement
&lt;/h3&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%2F69hpobc1h5749uzidtak.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%2F69hpobc1h5749uzidtak.png" alt="blow the Problem Statement" width="800" height="518"&gt;&lt;/a&gt;&lt;br&gt;
as we know that, we can solve several ways but we would solve it with regex &lt;/p&gt;

&lt;h3&gt;
  
  
  let's do solve with java
&lt;/h3&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%2Fxwxb3029wub22bcgrojr.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%2Fxwxb3029wub22bcgrojr.png" alt="let's do solve with java" width="800" height="487"&gt;&lt;/a&gt;&lt;br&gt;
above the solution now we're going to explain that what's happening here.&lt;br&gt;
as we see that ParsonlIdNumber class inside of the validate function which returns boolean, also we need just return boolean.&lt;br&gt;
&lt;code&gt;pin&lt;/code&gt; is a parameter associated with matches method &lt;code&gt;matches()&lt;/code&gt; is building method in java.&lt;br&gt;
however. at first, we have used &lt;code&gt;^&lt;/code&gt; it means Matches the beginning of a line.&lt;br&gt;
&lt;code&gt;()&lt;/code&gt; it means Capturing group: Matches and remembers the match.&lt;br&gt;
&lt;code&gt;\d&lt;/code&gt; it means Matches any digit. Equivalent to [0-9]. also, The extra &lt;code&gt;\&lt;/code&gt; in &lt;code&gt;\\d&lt;/code&gt; is used to escape the backslash from the string.&lt;br&gt;
&lt;code&gt;{}&lt;/code&gt; it means Matches n number repetitions of the previous character or expression.&lt;br&gt;
&lt;code&gt;|&lt;/code&gt; it means Matches either "x" or "y". we can relate like a boolean OR. Matches the expression before or after.&lt;br&gt;
&lt;code&gt;$&lt;/code&gt; it means Matches the end of the line.&lt;br&gt;
how did this pattern &lt;code&gt;^(\\d{4}|\\d{6})$&lt;/code&gt; work.&lt;br&gt;
start with the number 4 or 6 time with ending. that's our result.&lt;/p&gt;

&lt;h2&gt;
  
  
  end of this article: Keep Learning
&lt;/h2&gt;

&lt;p&gt;That’s the end of this article, but keep learning and practicing.&lt;/p&gt;

&lt;p&gt;I've tried to a couple of examples with solved the problem, because  if we see some use cases it really helpful for us to understanding any particular concept that's why I solved the problem by exploring how does work regex.&lt;/p&gt;

&lt;p&gt;I don't know could I explain properly or not but I tried as much as possible to explained. if I've mistaken anything please share it with me I'll correct it.&lt;/p&gt;

&lt;p&gt;I really passionate about sharing my knowledge Through write an article and in the future, I'll try to write another concept article until stay safe.&lt;/p&gt;

&lt;p&gt;happy coding✌️&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>java</category>
      <category>python</category>
    </item>
  </channel>
</rss>
