<?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: Ragul</title>
    <description>The latest articles on DEV Community by Ragul (@ragul_kannadasan).</description>
    <link>https://dev.to/ragul_kannadasan</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4018026%2Fbd834cfc-5402-4eea-98ac-080d0580b684.jpg</url>
      <title>DEV Community: Ragul</title>
      <link>https://dev.to/ragul_kannadasan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ragul_kannadasan"/>
    <language>en</language>
    <item>
      <title>Base64</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Thu, 10 Sep 2026 19:45:27 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/base64-1kol</link>
      <guid>https://dev.to/ragul_kannadasan/base64-1kol</guid>
      <description>&lt;h2&gt;
  
  
  What Base64 Actually Is
&lt;/h2&gt;

&lt;p&gt;Base64 is a way of representing binary data — images, files, encrypted bytes, anything made of raw 0s and 1s — using only printable text characters. It's not encryption, and it's not compression. It's purely a &lt;em&gt;translation&lt;/em&gt; from binary into a text-safe format.&lt;/p&gt;

&lt;p&gt;The name comes from the fact that it uses a 64-character alphabet:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uppercase letters: &lt;code&gt;A–Z&lt;/code&gt; (26 characters)&lt;/li&gt;
&lt;li&gt;Lowercase letters: &lt;code&gt;a–z&lt;/code&gt; (26 characters)&lt;/li&gt;
&lt;li&gt;Digits: &lt;code&gt;0–9&lt;/code&gt; (10 characters)&lt;/li&gt;
&lt;li&gt;Two symbols, usually &lt;code&gt;+&lt;/code&gt; and &lt;code&gt;/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;=&lt;/code&gt; character, used for padding at the end&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;64 possible values map neatly onto 6 bits of data (since 2⁶ = 64), which is the mathematical trick that makes the whole scheme work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Base64 Exists
&lt;/h2&gt;

&lt;p&gt;Many systems — old email protocols, certain text fields, JSON, XML, and URLs — were designed to handle plain text, not arbitrary binary data. Sending raw binary through these channels can cause problems: bytes might get misinterpreted, special characters might break formatting, or control characters might get silently stripped or altered.&lt;/p&gt;

&lt;p&gt;Base64 solves this by converting any binary data into a stream of safe, printable ASCII characters that can pass through virtually any text-based system without corruption.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the Encoding Works
&lt;/h2&gt;

&lt;p&gt;The process is mechanical once you see it laid out:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Take the binary data and group it into chunks of 3 bytes (24 bits).&lt;/li&gt;
&lt;li&gt;Split those 24 bits into four groups of 6 bits each.&lt;/li&gt;
&lt;li&gt;Map each 6-bit group to a character in the Base64 alphabet.&lt;/li&gt;
&lt;li&gt;If the final group of bytes doesn't divide evenly into 3, pad the output with &lt;code&gt;=&lt;/code&gt; characters so the length stays a multiple of 4.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's why encoded Base64 output is always about &lt;strong&gt;33% larger&lt;/strong&gt; than the original data — three bytes of binary become four bytes of text.&lt;/p&gt;

&lt;p&gt;A quick example: the text &lt;code&gt;"Man"&lt;/code&gt; (3 bytes: &lt;code&gt;M&lt;/code&gt;, &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;n&lt;/code&gt;) encodes to &lt;code&gt;TWFu&lt;/code&gt;. Three ASCII characters go in, four Base64 characters come out — a clean, evenly divisible case with no padding needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where You'll Actually See It
&lt;/h2&gt;

&lt;p&gt;Base64 shows up in more places than most people realize:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Email attachments&lt;/strong&gt; — MIME uses Base64 to embed images, PDFs, and other files inside plain-text email messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data URLs&lt;/strong&gt; — Small images or fonts can be embedded directly into HTML or CSS using &lt;code&gt;data:image/png;base64,...&lt;/code&gt; instead of a separate file request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;APIs and JSON&lt;/strong&gt; — Since JSON only supports text, binary payloads like images or files are often Base64-encoded before being included in a request or response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt; — Basic HTTP authentication headers encode the &lt;code&gt;username:password&lt;/code&gt; pair in Base64 (note: this is &lt;em&gt;not&lt;/em&gt; secure on its own, since Base64 is trivially reversible).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storing binary data in databases or config files&lt;/strong&gt; that only support text fields.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Common Misconception
&lt;/h2&gt;

&lt;p&gt;Because Base64-encoded text looks scrambled, people sometimes assume it's a form of encryption or security. It isn't. Anyone can decode Base64 instantly using a browser console, a command-line tool, or countless free websites — there's no secret key involved. It should be thought of purely as a &lt;em&gt;format conversion&lt;/em&gt;, never as a way to protect sensitive information.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Trade-Off to Remember
&lt;/h2&gt;

&lt;p&gt;Base64 solves a real compatibility problem, but it isn't free. That roughly 33% size increase matters when you're sending large files over a network or storing lots of encoded data — it's extra bandwidth and storage for no added value beyond text-safety. In situations where binary transfer is already supported (like most modern file uploads), skipping Base64 entirely is usually the better choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Takeaway
&lt;/h2&gt;

&lt;p&gt;Base64 is a small, elegant piece of engineering that quietly keeps a huge portion of the internet working smoothly. It doesn't protect data and it doesn't shrink it — it simply makes binary information speak the universal language of plain text, so it can travel safely through systems that were never built to handle anything else.&lt;/p&gt;

</description>
      <category>data</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Tailscale</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Wed, 09 Sep 2026 18:38:48 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/tailscale-155k</link>
      <guid>https://dev.to/ragul_kannadasan/tailscale-155k</guid>
      <description>&lt;h2&gt;
  
  
  What Tailscale Actually Is
&lt;/h2&gt;

&lt;p&gt;Tailscale is a &lt;strong&gt;mesh VPN&lt;/strong&gt; built on top of &lt;a href="https://www.wireguard.com/" rel="noopener noreferrer"&gt;WireGuard&lt;/a&gt;, a modern, minimal, heavily-audited VPN protocol. Install the Tailscale client on your laptop, phone, or server, sign in with an existing account (Google, GitHub, Microsoft, etc.), and that device joins your &lt;strong&gt;tailnet&lt;/strong&gt; — a private network only your devices can see.&lt;/p&gt;

&lt;p&gt;Unlike a traditional VPN, there's no central server all your traffic funnels through. Devices connect &lt;strong&gt;directly to each other&lt;/strong&gt; wherever possible, encrypted end-to-end. Tailscale's infrastructure only helps devices find each other and negotiate that connection — it doesn't sit in the middle of your actual traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why People Use It
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No more painful VPN setup.&lt;/strong&gt; No port forwarding, no static IP allowlists — install the client, log in, done.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Works through NAT and firewalls automatically.&lt;/strong&gt; Two devices behind separate home routers can still find a direct path to each other. When that's not possible, traffic relays through Tailscale's servers — still fully encrypted, just routed rather than direct.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Great for individuals, not just companies.&lt;/strong&gt; A huge part of Tailscale's popularity comes from hobbyists running a home lab, self-hosting things like Nextcloud or Home Assistant, or just wanting to reach their desktop from anywhere. The free tier covers personal use with a generous device limit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Standout Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MagicDNS&lt;/strong&gt; — every device gets a stable hostname (&lt;code&gt;myserver.tailnet-name.ts.net&lt;/code&gt;) instead of you needing to remember an IP.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Taildrop&lt;/strong&gt; — AirDrop-style file transfer between your own devices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subnet routers and exit nodes&lt;/strong&gt; — expose your whole home LAN to your tailnet, or route all internet traffic through a trusted device.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tailscale SSH&lt;/strong&gt; — identity-based SSH access without manual key management.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My Setup: Home Server + Nextcloud
&lt;/h2&gt;

&lt;p&gt;I use Tailscale specifically to reach my home server and my self-hosted Nextcloud storage — without opening any ports to the public internet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Home server access&lt;/strong&gt; — I install the Tailscale client directly on the home server, so it joins my tailnet just like my laptop and phone do. From anywhere, I can reach it by its Tailscale hostname instead of a public IP.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nextcloud access&lt;/strong&gt; — instead of exposing Nextcloud's port 443 to the internet, I point the Nextcloud desktop and mobile apps at the server's Tailscale hostname (e.g. &lt;code&gt;homeserver.tailnet-name.ts.net&lt;/code&gt;). This keeps file sync and access completely private to my own devices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MagicDNS&lt;/strong&gt; — turned on so I never have to remember or type IP addresses for either service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mobile access&lt;/strong&gt; — the Tailscale app has to be running in the background on my phone before the Nextcloud app can reach the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTPS&lt;/strong&gt; — using &lt;code&gt;tailscale cert&lt;/code&gt; to get a real Let's Encrypt-backed certificate for the tailnet hostname, so there are no self-signed cert warnings in the Nextcloud clients.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This setup means my storage server is reachable from any of my devices, anywhere, with no port forwarding and no attack surface exposed to the public internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a free account at tailscale.com.&lt;/li&gt;
&lt;li&gt;Install the client on two devices.&lt;/li&gt;
&lt;li&gt;Log in on both.&lt;/li&gt;
&lt;li&gt;Ping one from the other by hostname.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No port forwarding, no static IPs, no certificate management required to get started.&lt;/p&gt;

</description>
      <category>tailscale</category>
      <category>vpn</category>
      <category>network</category>
      <category>privacy</category>
    </item>
    <item>
      <title>Promises in JavaScript</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Mon, 07 Sep 2026 17:33:59 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/promises-in-javascript-1pc0</link>
      <guid>https://dev.to/ragul_kannadasan/promises-in-javascript-1pc0</guid>
      <description>&lt;p&gt;Imagine you order food at a restaurant. The waiter doesn't hand you the food right away — they hand you an order ticket instead. That ticket is a promise: your food &lt;em&gt;will&lt;/em&gt; arrive, or the kitchen will tell you they're out of what you ordered. Either way, you're not just standing there frozen, waiting. You can keep chatting with your friends until the food (or the bad news) shows up.&lt;/p&gt;

&lt;p&gt;That's exactly what a Promise is in JavaScript. It's a placeholder for something that will finish later, like fetching data from the internet, which doesn't happen instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Three States
&lt;/h2&gt;

&lt;p&gt;A Promise is always in one of three states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pending&lt;/strong&gt; – still waiting, like your food order still cooking&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fulfilled&lt;/strong&gt; – it worked, your food arrived&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rejected&lt;/strong&gt; – it failed, the kitchen ran out&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once it lands on fulfilled or rejected, it stays there. No take-backs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Not Just Wait?
&lt;/h2&gt;

&lt;p&gt;JavaScript doesn't like to sit around doing nothing while waiting for slow things like network requests. Instead of freezing the whole page, it hands you a Promise and moves on. Later, when the slow thing finishes, your Promise tells you what happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using a Promise
&lt;/h2&gt;

&lt;p&gt;The most common way to work with Promises today is &lt;code&gt;async/await&lt;/code&gt;, because it reads almost like normal step-by-step code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getWeather&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchWeather&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;data&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 &lt;code&gt;await&lt;/code&gt; just means "pause here until this is done, then continue." If something goes wrong, you catch it like this:&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getWeather&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchWeather&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;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;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Couldn't get the weather.&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's really the whole idea: &lt;code&gt;await&lt;/code&gt; for waiting, &lt;code&gt;try/catch&lt;/code&gt; for handling problems.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Callback in JavaScript</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Fri, 04 Sep 2026 18:34:24 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/callback-in-javascript-272d</link>
      <guid>https://dev.to/ragul_kannadasan/callback-in-javascript-272d</guid>
      <description>&lt;p&gt;If you're just starting out with JavaScript, you've probably come across the word "callback" and felt a little confused. Don't worry — it's a simple idea with a slightly intimidating name. Let's break it down.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Simple Definition
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A callback is just a function that you pass into another function, so it can be run later.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's really it. In JavaScript, functions aren't just things you &lt;em&gt;call&lt;/em&gt; — they're values you can pass around, just like a number or a string. So you can hand a function to another function as an argument.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Real-Life Analogy
&lt;/h2&gt;

&lt;p&gt;Imagine you order food at a restaurant. Instead of standing at the counter waiting for it, you give the cashier your phone number. They call you back the moment your food is ready.&lt;/p&gt;

&lt;p&gt;You didn't wait around doing nothing — and the cashier knows exactly what to do once your order is done: call your number.&lt;/p&gt;

&lt;p&gt;That's exactly what a callback is. You're saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Here's a function. Run it once you're done doing your thing."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  A Simple Code Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;orderFood&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Order placed!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;pickUpOrder&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Order picked up!&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="nf"&gt;orderFood&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pickUpOrder&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Order placed!
Order picked up!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;pickUpOrder&lt;/code&gt; is the &lt;strong&gt;callback&lt;/strong&gt; — a function passed into &lt;code&gt;orderFood&lt;/code&gt;, to be run when &lt;code&gt;orderFood&lt;/code&gt; decides it's time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Not Just Call the Function Normally?
&lt;/h2&gt;

&lt;p&gt;Good question. In the example above, you could've just called &lt;code&gt;pickUpOrder()&lt;/code&gt; directly and it would look the same. But callbacks become important when something takes &lt;strong&gt;time&lt;/strong&gt; — like waiting for a timer, a file to load, or data from a server.&lt;/p&gt;

&lt;p&gt;JavaScript doesn't freeze and wait around for these things. Instead, it keeps running your other code, and calls your callback function later, once the task is finished.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Order placed!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;setTimeout&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="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="s2"&gt;Order ready!&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="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// waits 3 seconds&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="s2"&gt;Doing homework while I wait...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Order placed!
Doing homework while I wait...
Order ready!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice: &lt;code&gt;"Order ready!"&lt;/code&gt; shows up &lt;em&gt;last&lt;/em&gt;, even though it's written in the middle of the code. That's the whole point of a callback — it runs &lt;em&gt;whenever the task finishes&lt;/em&gt;, not necessarily in the order it's written.&lt;/p&gt;

&lt;h2&gt;
  
  
  You've Probably Already Used One
&lt;/h2&gt;

&lt;p&gt;If you've ever written code like this, you've used a callback without knowing it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;click&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="o"&gt;=&amp;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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Button clicked!&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The arrow function here is a callback — it doesn't run right away. It waits until the button is actually clicked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A callback is a function passed into another function.&lt;/li&gt;
&lt;li&gt;It gets called ("called back") once that other function is ready for it.&lt;/li&gt;
&lt;li&gt;Callbacks are especially useful for things that take time — timers, clicks, loading data — so your code doesn't have to freeze and wait.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once this clicks, you're ready to explore where callbacks are used everywhere in JavaScript — from button clicks to loading data from the internet. It's one of the most important building blocks to understand as a beginner.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>callbacks</category>
      <category>programming</category>
    </item>
    <item>
      <title>Functions in JavaScript</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Wed, 02 Sep 2026 17:19:14 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/functions-in-javascript-39hj</link>
      <guid>https://dev.to/ragul_kannadasan/functions-in-javascript-39hj</guid>
      <description>&lt;p&gt;Functions are one of the most fundamental building blocks in JavaScript. They let you package up a piece of logic, give it a name, and reuse it wherever you need it. If you're learning JavaScript, getting comfortable with functions early will save you a lot of headaches later on.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a Function?
&lt;/h2&gt;

&lt;p&gt;At its core, a function is a reusable block of code designed to perform a specific task. Instead of writing the same logic over and over, you write it once inside a function and simply "call" that function whenever you need it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&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="s2"&gt;`Hello, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ragul&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Hello, Ragul!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;greet&lt;/code&gt; takes an input (called a &lt;strong&gt;parameter&lt;/strong&gt;), does something with it, and returns an output.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ways to Write Functions
&lt;/h2&gt;

&lt;p&gt;JavaScript gives you several ways to define a function, and each has its own use cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Function Declarations
&lt;/h3&gt;

&lt;p&gt;This is the classic style, and it's "hoisted" — meaning you can call it before it appears in your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&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;h3&gt;
  
  
  2. Function Expressions
&lt;/h3&gt;

&lt;p&gt;Here, a function is assigned to a variable. Unlike declarations, these are not hoisted in the same way, so they must be defined before use.&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;multiply&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&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;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;b&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;h3&gt;
  
  
  3. Arrow Functions
&lt;/h3&gt;

&lt;p&gt;Introduced in ES6, arrow functions offer a shorter syntax and behave differently with &lt;code&gt;this&lt;/code&gt; (more on that below).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;subtract&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a single expression, you can even skip the curly braces and the &lt;code&gt;return&lt;/code&gt; keyword — the result is returned automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parameters and Default Values
&lt;/h2&gt;

&lt;p&gt;Functions can take any number of parameters, and you can assign them default values in case no argument is passed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;friend&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="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`Hey there, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// Hey there, friend!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also accept an unlimited number of arguments using the &lt;strong&gt;rest parameter&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;function&lt;/span&gt; &lt;span class="nf"&gt;sumAll&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;numbers&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;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;n&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sumAll&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="mi"&gt;2&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="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>codequality</category>
      <category>javascript</category>
      <category>core</category>
    </item>
    <item>
      <title>Arrays in JavaScript</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Tue, 01 Sep 2026 18:26:01 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/arrays-in-javascript-17g4</link>
      <guid>https://dev.to/ragul_kannadasan/arrays-in-javascript-17g4</guid>
      <description>&lt;p&gt;Arrays are one of the most fundamental data structures in JavaScript. They let you store multiple values in a single variable, and JavaScript gives you a rich set of built-in methods to work with them. In this post, we'll explore arrays and dig into some of the most commonly used methods: &lt;code&gt;push&lt;/code&gt;, &lt;code&gt;pop&lt;/code&gt;, &lt;code&gt;shift&lt;/code&gt;, &lt;code&gt;unshift&lt;/code&gt;, and &lt;code&gt;slice&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an Array?
&lt;/h2&gt;

&lt;p&gt;An array is an ordered collection of values. You can create one using square brackets:&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;fruits&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="s2"&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="s2"&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="s2"&gt;mango&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;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ["apple", "banana", "mango"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each item in an array has an &lt;strong&gt;index&lt;/strong&gt;, starting from &lt;code&gt;0&lt;/code&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="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;fruits&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;// "apple"&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;fruits&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="c1"&gt;// "mango"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Arrays can hold any type of data — strings, numbers, objects, even other arrays — and you can mix types freely:&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;mixed&lt;/span&gt; &lt;span class="o"&gt;=&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;two&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;three&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="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding and Removing Elements
&lt;/h2&gt;

&lt;p&gt;JavaScript gives you four core methods for adding or removing items from the ends of an array: &lt;code&gt;push&lt;/code&gt;, &lt;code&gt;pop&lt;/code&gt;, &lt;code&gt;shift&lt;/code&gt;, and &lt;code&gt;unshift&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;push()&lt;/code&gt; — Add to the End
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;push()&lt;/code&gt; adds one or more elements to the &lt;strong&gt;end&lt;/strong&gt; of an array and returns the new length.&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;fruits&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="s2"&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="s2"&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;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mango&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;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ["apple", "banana", "mango"]&lt;/span&gt;

&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kiwi&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="s2"&gt;grape&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;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ["apple", "banana", "mango", "kiwi", "grape"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;pop()&lt;/code&gt; — Remove from the End
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;pop()&lt;/code&gt; removes the &lt;strong&gt;last&lt;/strong&gt; element from an array and returns that removed value.&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;fruits&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="s2"&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="s2"&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="s2"&gt;mango&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;removed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&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;removed&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "mango"&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;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// ["apple", "banana"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;push&lt;/code&gt; and &lt;code&gt;pop&lt;/code&gt; are fast because they only affect the end of the array — this makes them ideal for implementing things like a &lt;strong&gt;stack&lt;/strong&gt; (Last In, First Out).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;unshift()&lt;/code&gt; — Add to the Beginning
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;unshift()&lt;/code&gt; adds one or more elements to the &lt;strong&gt;start&lt;/strong&gt; of an array and returns the new length.&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;fruits&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="s2"&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="s2"&gt;mango&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unshift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&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;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;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ["apple", "banana", "mango"]&lt;/span&gt;

&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unshift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kiwi&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="s2"&gt;grape&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;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ["kiwi", "grape", "apple", "banana", "mango"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;shift()&lt;/code&gt; — Remove from the Beginning
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;shift()&lt;/code&gt; removes the &lt;strong&gt;first&lt;/strong&gt; element from an array and returns that removed value.&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;fruits&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="s2"&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="s2"&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="s2"&gt;mango&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;removed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shift&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;removed&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "apple"&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;fruits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// ["banana", "mango"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;shift&lt;/code&gt; and &lt;code&gt;unshift&lt;/code&gt; are useful for implementing a &lt;strong&gt;queue&lt;/strong&gt; (First In, First Out), though keep in mind they're slower than &lt;code&gt;push&lt;/code&gt;/&lt;code&gt;pop&lt;/code&gt; on large arrays since every remaining element has to shift its index.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quick Comparison
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;Affects&lt;/th&gt;
&lt;th&gt;Returns&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;push()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Add to end&lt;/td&gt;
&lt;td&gt;End&lt;/td&gt;
&lt;td&gt;New array length&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pop()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remove from end&lt;/td&gt;
&lt;td&gt;End&lt;/td&gt;
&lt;td&gt;Removed element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;unshift()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Add to beginning&lt;/td&gt;
&lt;td&gt;Start&lt;/td&gt;
&lt;td&gt;New array length&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;shift()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remove from beginning&lt;/td&gt;
&lt;td&gt;Start&lt;/td&gt;
&lt;td&gt;Removed element&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;slice()&lt;/code&gt; — Extracting a Portion of an Array
&lt;/h2&gt;

&lt;p&gt;Unlike the methods above, &lt;code&gt;slice()&lt;/code&gt; doesn't modify the original array. Instead, it returns a &lt;strong&gt;new array&lt;/strong&gt; containing a copy of a portion of the original, based on start and end indices.&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;numbers&lt;/span&gt; &lt;span class="o"&gt;=&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="mi"&gt;20&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="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&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;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&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="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// [20, 30]&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;numbers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;             &lt;span class="c1"&gt;// [10, 20, 30, 40, 50] (unchanged!)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Syntax: &lt;code&gt;array.slice(startIndex, endIndex)&lt;/code&gt; — the &lt;code&gt;endIndex&lt;/code&gt; is &lt;strong&gt;not included&lt;/strong&gt; in the result.&lt;/p&gt;

&lt;p&gt;A few handy variations:&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;numbers&lt;/span&gt; &lt;span class="o"&gt;=&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="mi"&gt;20&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="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&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="c1"&gt;// [30, 40, 50]  → from index 2 to the end&lt;/span&gt;
&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;    &lt;span class="c1"&gt;// [40, 50]      → last two elements&lt;/span&gt;
&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;      &lt;span class="c1"&gt;// [10, 20, 30, 40, 50] → a full shallow copy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That last example — calling &lt;code&gt;slice()&lt;/code&gt; with no arguments — is a common trick for cloning an array without mutating the original.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;slice()&lt;/code&gt; vs &lt;code&gt;splice()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;It's worth noting that &lt;code&gt;slice()&lt;/code&gt; is often confused with &lt;code&gt;splice()&lt;/code&gt;. The key difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;slice()&lt;/code&gt;&lt;/strong&gt; — does &lt;em&gt;not&lt;/em&gt; change the original array; returns a new array.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;splice()&lt;/code&gt;&lt;/strong&gt; — &lt;em&gt;does&lt;/em&gt; change the original array; can add or remove elements in place.
&lt;/li&gt;
&lt;/ul&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;numbers&lt;/span&gt; &lt;span class="o"&gt;=&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="mi"&gt;20&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="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&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="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// removes 2 elements starting at index 1&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;numbers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// [10, 40, 50] (original array is modified!)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://file-download-server.vercel.app/api/download?token=MWNhMGQ0ZTU1NjgwZmQ3Y2I0OWY3OTc4Y2FmNDBhOWE6YzEzYzFlYzBlZGZkNDc2ZmJhNDQxZDFlZDA1MTZiODU%3D" rel="noopener noreferrer"&gt;click to download Arrays.js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>coding</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>History of the Internet</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Tue, 01 Sep 2026 02:31:01 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/history-of-the-internet-176e</link>
      <guid>https://dev.to/ragul_kannadasan/history-of-the-internet-176e</guid>
      <description>&lt;p&gt;The Internet has fundamentally changed how we work, learn, and connect. It evolved from a clunky military experiment into the invisible digital fabric that holds our modern world together. &lt;/p&gt;

&lt;p&gt;Let’s take a trip back in time and break down the fascinating, year-by-year history of how the Internet came to be!&lt;/p&gt;




&lt;h4&gt;
  
  
  1. The Early Years (Connecting the First Computers)
&lt;/h4&gt;

&lt;p&gt;Before there were websites or smartphones, there were massive, room-sized computers that couldn't even talk to each other.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;1969 (The First Connection):&lt;/strong&gt; Funded by the US Department of Defense, &lt;strong&gt;ARPANET&lt;/strong&gt; became the world’s first packet-switching network. The very first message, "LO" (intended to be "LOGIN"), was sent between UCLA and Stanford. It crashed halfway through, but history was made.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;1971 (The First Email):&lt;/strong&gt; Programmer Ray Tomlinson invented network email, famously choosing the &lt;strong&gt;@ symbol&lt;/strong&gt; to separate the user's name from the computer's name.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;1983 (Birth of the Modern Internet):&lt;/strong&gt; On January 1, 1983, ARPANET officially adopted the &lt;strong&gt;TCP/IP&lt;/strong&gt; protocol. This gave different computer networks a universal language to communicate with each other, officially birthing the "Internet" as a network of networks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. The 1990s (The Web Goes Public)
&lt;/h4&gt;

&lt;p&gt;For a long time, the Internet was just text on a screen used by academics and researchers. The 90s brought graphics, hyperlinks, and everyday users.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;1989 - 1991 (The World Wide Web):&lt;/strong&gt; Tim Berners-Lee invented the World Wide Web at CERN, creating HTML, HTTP, and URLs. In 1991, the Web became publicly accessible, giving the Internet a user-friendly interface.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;1993 (The First Browser):&lt;/strong&gt; The &lt;strong&gt;Mosaic&lt;/strong&gt; browser was released. It was the first popular graphical browser, meaning you could finally see images and text side-by-side.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;1995 (The Commercial Boom):&lt;/strong&gt; The Internet became a place for business. Heavyweights like &lt;strong&gt;Amazon&lt;/strong&gt; and &lt;strong&gt;eBay&lt;/strong&gt; opened their virtual doors, and the browser wars began.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;1998 (The Search Engine King):&lt;/strong&gt; &lt;strong&gt;Google&lt;/strong&gt; was founded in a Stanford dorm room, forever changing how we organize and find information online.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. The 2000s and Beyond (Broadband, Social, and Mobile)
&lt;/h4&gt;

&lt;p&gt;The 2000s saw the Internet move from sluggish dial-up modems to an "always-on" culture.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;2001 (Crowdsourced Knowledge):&lt;/strong&gt; &lt;strong&gt;Wikipedia&lt;/strong&gt; launched, proving that massive, collaborative information sharing was possible.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;2004 - 2005 (The Social Revolution):&lt;/strong&gt; &lt;strong&gt;Facebook&lt;/strong&gt; launched in 2004, followed by &lt;strong&gt;YouTube&lt;/strong&gt; in 2005. The Internet shifted from consuming static pages to creating and sharing user-generated content.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;2007 (The Mobile Internet):&lt;/strong&gt; Apple released the &lt;strong&gt;iPhone&lt;/strong&gt;, putting the power of the entire Internet into the pockets of millions and sparking the mobile app revolution.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Quick Cheat Sheet: The Internet Timeline&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Year&lt;/th&gt;
&lt;th&gt;Milestone&lt;/th&gt;
&lt;th&gt;Why It Matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1969&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;ARPANET&lt;/td&gt;
&lt;td&gt;The first computers connect and share data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1971&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;First Email&lt;/td&gt;
&lt;td&gt;Introduction of the @ symbol for digital messages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1983&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;TCP/IP Adopted&lt;/td&gt;
&lt;td&gt;Different networks could finally speak the same language&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1991&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;WWW Public Release&lt;/td&gt;
&lt;td&gt;Websites and hyperlinks become accessible to everyone&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1995&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Dot-Com Boom&lt;/td&gt;
&lt;td&gt;Amazon, eBay, and the commercial web take off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;2007&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The iPhone&lt;/td&gt;
&lt;td&gt;Brought widespread mobile internet access to the masses&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>internet</category>
      <category>web</category>
      <category>http</category>
    </item>
    <item>
      <title>Flutter</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Sat, 29 Aug 2026 19:03:53 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/flutter-49ob</link>
      <guid>https://dev.to/ragul_kannadasan/flutter-49ob</guid>
      <description>&lt;p&gt;&lt;a href="https://flutter.dev/" rel="noopener noreferrer"&gt;&lt;strong&gt;Flutter&lt;/strong&gt;&lt;/a&gt; is an open-source UI software development kit (SDK) created by Google for building natively compiled, multi-platform applications from a single codebase.&lt;/p&gt;

&lt;p&gt;It supports the development of applications for mobile (iOS, Android), web, desktop (Windows, macOS, Linux), and embedded devices.&lt;/p&gt;




&lt;h3&gt;
  
  
  Key Characteristics
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Language:&lt;/strong&gt; It uses the Dart programming language, which is optimized for fast development and high performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Widgets:&lt;/strong&gt; The framework is built around a widget-based architecture where the user interface is composed of various customizable widgets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance:&lt;/strong&gt; Flutter compiles code to native machine code (ARM/Intel) or JavaScript, allowing it to bypass traditional web views or bridges for high performance and smooth rendering via its own 2D rendering engine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hot Reload:&lt;/strong&gt; It features a "hot reload" capability that allows developers to see code changes in real-time without restarting the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Platform:&lt;/strong&gt; It enables developers to write code once and deploy it across six major platforms, significantly reducing development time and cost compared to native development.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://flutter.dev/" rel="noopener noreferrer"&gt;https://flutter.dev/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>webdev</category>
      <category>build2learn</category>
    </item>
    <item>
      <title>JavaScript Loops</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Fri, 28 Aug 2026 18:03:25 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/javascript-loops-3feb</link>
      <guid>https://dev.to/ragul_kannadasan/javascript-loops-3feb</guid>
      <description>&lt;p&gt;Have you ever found yourself writing the same line of code over and over again? &lt;/p&gt;

&lt;p&gt;Imagine needing to log numbers from 1 to 100 or process a list of items. Writing 100 &lt;code&gt;console.log()&lt;/code&gt; statements is not only exhausting—it breaks the core programming rule: &lt;strong&gt;DRY (Don't Repeat Yourself)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s where &lt;strong&gt;Loops&lt;/strong&gt; come to the rescue!&lt;/p&gt;

&lt;p&gt;In this guide, we'll break down the three fundamental loops in JavaScript:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;while&lt;/code&gt; Loop&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;do...while&lt;/code&gt; Loop&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;for&lt;/code&gt; Loop&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s dive into how each works, when to use them, and how to avoid the dreaded infinite loop!&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The &lt;code&gt;while&lt;/code&gt; Loop (Check First, Run Later)
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;while&lt;/code&gt; loop evaluates a condition &lt;strong&gt;before&lt;/strong&gt; executing the code block. If the condition is &lt;code&gt;true&lt;/code&gt;, the code runs; if it's &lt;code&gt;false&lt;/code&gt;, JavaScript skips it entirely.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Code to execute as long as condition is true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Practical Example
&lt;/h3&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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&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;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&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="s2"&gt;`Count is: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&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="c1"&gt;// Don't forget to update your counter!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Count is: 1
Count is: 2
Count is: 3
Count is: 4
Count is: 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How It Works Step-by-Step
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Initialize &lt;code&gt;count = 1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Check if &lt;code&gt;count &amp;lt;= 5&lt;/code&gt; (1 &amp;lt;= 5 is &lt;code&gt;true&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Run the body → prints &lt;code&gt;Count is: 1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Increment &lt;code&gt;count&lt;/code&gt; to 2.&lt;/li&gt;
&lt;li&gt;Repeat until &lt;code&gt;count&lt;/code&gt; becomes 6.&lt;/li&gt;
&lt;li&gt;Check &lt;code&gt;count &amp;lt;= 5&lt;/code&gt; (6 &amp;lt;= 5 is &lt;code&gt;false&lt;/code&gt;) → Loop terminates!&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Best Use Case:&lt;/strong&gt; When you don't know the exact number of iterations in advance (e.g., polling an API until a status changes to &lt;code&gt;"ready"&lt;/code&gt; or waiting for specific user input).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. The &lt;code&gt;do...while&lt;/code&gt; Loop (Run First, Check Later)
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;do...while&lt;/code&gt; loop is very similar to the &lt;code&gt;while&lt;/code&gt; loop, with one crucial difference: &lt;strong&gt;it is guaranteed to run at least once&lt;/strong&gt;, even if the condition is &lt;code&gt;false&lt;/code&gt; from the start.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Code executes first...&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;condition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ...then condition is checked!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example: Normal Execution
&lt;/h3&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;attempts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;do&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="s2"&gt;`Attempt #&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;attempts&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="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Attempt #1
Attempt #2
Attempt #3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What Happens When Condition Starts as False?
&lt;/h3&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;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;do&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="s2"&gt;`Current score: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&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;score&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Current score: 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though &lt;code&gt;score &amp;lt; 50&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt;, the code block still executed once before evaluating the condition!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Best Use Case:&lt;/strong&gt; When an action must occur at least once regardless of conditions (e.g., prompting a user for input, rolling a die at least once, or performing an initial handshake attempt).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. The &lt;code&gt;for&lt;/code&gt; Loop (The All-in-One Powerhouse)
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;for&lt;/code&gt; loop is the most commonly used loop in JavaScript. It neatly combines &lt;strong&gt;initialization&lt;/strong&gt;, &lt;strong&gt;condition&lt;/strong&gt;, and &lt;strong&gt;update/increment&lt;/strong&gt; in a single, compact line.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialization&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;update&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Code to execute&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Initialization:&lt;/strong&gt; Executes once before the loop starts (&lt;code&gt;let i = 0&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Condition:&lt;/strong&gt; Evaluated before every iteration (&lt;code&gt;i &amp;lt; 5&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update:&lt;/strong&gt; Executes after every iteration (&lt;code&gt;i++&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Practical Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;for &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;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&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="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="s2"&gt;`Iteration: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Iteration: 1
Iteration: 2
Iteration: 3
Iteration: 4
Iteration: 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Real-World Example: Iterating Over an Array
&lt;/h3&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;frameworks&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="s2"&gt;React&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="s2"&gt;Vue&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="s2"&gt;Angular&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="s2"&gt;Svelte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;for &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;i&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="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;frameworks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&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="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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;. &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;frameworks&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&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;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. React
2. Vue
3. Angular
4. Svelte
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Best Use Case:&lt;/strong&gt; When you know exactly how many times the loop should run (e.g., fixed counts, iterating arrays via indices).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Bonus: Loop Controls (&lt;code&gt;break&lt;/code&gt; and &lt;code&gt;continue&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Want more control inside your loops? Use these two keywords:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;break&lt;/code&gt;&lt;/strong&gt;: Immediately exits the loop completely.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;for &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;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&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;i&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Exits when i reaches 4&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;i&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="c1"&gt;// Prints: 1, 2, 3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;continue&lt;/code&gt;&lt;/strong&gt;: Skips the current iteration and jumps straight to the next one.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;for &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;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Skips printing 3&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;i&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="c1"&gt;// Prints: 1, 2, 4, 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Common Pitfall: The Infinite Loop
&lt;/h2&gt;

&lt;p&gt;If your condition never becomes &lt;code&gt;false&lt;/code&gt;, your loop will run forever and freeze/crash your browser or Node.js process.&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;// DANGER: Infinite Loop!&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&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;x&lt;/span&gt; &lt;span class="o"&gt;&amp;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="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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// x will always be greater than 0!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Always double-check your loop's exit condition and make sure your counter or state actually moves toward terminating!&lt;/p&gt;




&lt;h2&gt;
  
  
  Quick Summary &amp;amp; Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;while&lt;/code&gt; Loop&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;do...while&lt;/code&gt; Loop&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;for&lt;/code&gt; Loop&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Condition Check&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Before block executes&lt;/td&gt;
&lt;td&gt;After block executes&lt;/td&gt;
&lt;td&gt;Before each iteration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Minimum Runs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; times&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1&lt;/code&gt; time&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best For&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Dynamic / unknown iterations&lt;/td&gt;
&lt;td&gt;Must run at least once&lt;/td&gt;
&lt;td&gt;Known iterations / array indexing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Syntax Style&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Separate init &amp;amp; update&lt;/td&gt;
&lt;td&gt;Separate init &amp;amp; update&lt;/td&gt;
&lt;td&gt;Compact (all-in-one header)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




</description>
      <category>javascript</category>
      <category>loops</category>
      <category>development</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Markdown( .md) file</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Thu, 27 Aug 2026 16:08:34 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/markdown-md-file-3bhb</link>
      <guid>https://dev.to/ragul_kannadasan/markdown-md-file-3bhb</guid>
      <description>&lt;p&gt;If you've ever seen a file named &lt;code&gt;README.md&lt;/code&gt; on GitHub, or noticed text with weird &lt;code&gt;**stars**&lt;/code&gt; and &lt;code&gt;#&lt;/code&gt; symbols, you've run into Markdown. This guide explains what it is, why people use it, and how to write it — in plain, simple terms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;What Is Markdown?&lt;/li&gt;
&lt;li&gt;Why Do People Use It?&lt;/li&gt;
&lt;li&gt;Headings&lt;/li&gt;
&lt;li&gt;Bold and Italic Text&lt;/li&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;li&gt;Links&lt;/li&gt;
&lt;li&gt;Images&lt;/li&gt;
&lt;li&gt;Code&lt;/li&gt;
&lt;li&gt;Blockquotes&lt;/li&gt;
&lt;li&gt;Tables&lt;/li&gt;
&lt;li&gt;Horizontal Line&lt;/li&gt;
&lt;li&gt;Line Breaks (a Common Gotcha)&lt;/li&gt;
&lt;li&gt;Where Markdown Is Used&lt;/li&gt;
&lt;li&gt;Quick Summary&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  1. What Is Markdown?
&lt;/h2&gt;

&lt;p&gt;Markdown is a &lt;strong&gt;simple way to format text using plain symbols&lt;/strong&gt;, instead of clicking buttons like "Bold" or "Bullet List" in a word processor.&lt;/p&gt;

&lt;p&gt;You type something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Hello World&lt;/span&gt;
This is &lt;span class="gs"&gt;**bold**&lt;/span&gt; and this is &lt;span class="ge"&gt;*italic*&lt;/span&gt;.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And it turns into this when it's rendered (displayed nicely):&lt;/p&gt;

&lt;h1&gt;
  
  
  Hello World
&lt;/h1&gt;

&lt;p&gt;This is &lt;strong&gt;bold&lt;/strong&gt; and this is &lt;em&gt;italic&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The file itself is just a plain text file — nothing fancy — saved with a &lt;code&gt;.md&lt;/code&gt; extension (short for "Markdown"). You can open it in Notepad, VS Code, or any text editor, and it'll still make sense even unformatted, because the symbols are simple and readable on their own.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Why Do People Use It?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It's simple.&lt;/strong&gt; You don't need any special software — just a text editor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's readable even as plain text.&lt;/strong&gt; A &lt;code&gt;.md&lt;/code&gt; file looks fine even before it's turned into a nicely styled page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's everywhere.&lt;/strong&gt; GitHub, GitLab, Notion, Reddit, Discord, and countless apps understand Markdown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's fast to write.&lt;/strong&gt; No mouse clicks — just type symbols as you go.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's why documentation files, blog posts (like this one!), and README files are almost always written in Markdown.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Headings
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;#&lt;/code&gt; symbol to make headings. The number of &lt;code&gt;#&lt;/code&gt; symbols controls the size — one &lt;code&gt;#&lt;/code&gt; is the biggest heading, and it gets smaller from there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Heading 1 (biggest)&lt;/span&gt;
&lt;span class="gu"&gt;## Heading 2&lt;/span&gt;
&lt;span class="gu"&gt;### Heading 3&lt;/span&gt;
&lt;span class="gu"&gt;#### Heading 4 (smallest commonly used)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;h1&gt;
  
  
  Heading 1 (biggest)
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Heading 2
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Heading 3
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Heading 4 (smallest commonly used)
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Always leave a space after the &lt;code&gt;#&lt;/code&gt; symbols, or it won't work.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Bold and Italic Text
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;This is &lt;span class="gs"&gt;**bold text**&lt;/span&gt;.
This is &lt;span class="ge"&gt;*italic text*&lt;/span&gt;.
This is &lt;span class="gs"&gt;***bold and italic**&lt;/span&gt;&lt;span class="err"&gt;*&lt;/span&gt;.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;p&gt;This is &lt;strong&gt;bold text&lt;/strong&gt;.&lt;br&gt;
This is &lt;em&gt;italic text&lt;/em&gt;.&lt;br&gt;
This is &lt;strong&gt;&lt;em&gt;bold and italic&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can also use &lt;code&gt;__double underscores__&lt;/code&gt; for bold and &lt;code&gt;_single underscores_&lt;/code&gt; for italic — they work the same way. Most people stick to asterisks (&lt;code&gt;*&lt;/code&gt;) since it's more common.&lt;/p&gt;


&lt;h2&gt;
  
  
  5. Lists
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Bullet list&lt;/strong&gt; — use a dash, star, or plus sign:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; Apples
&lt;span class="p"&gt;-&lt;/span&gt; Bananas
&lt;span class="p"&gt;-&lt;/span&gt; Oranges
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apples&lt;/li&gt;
&lt;li&gt;Bananas&lt;/li&gt;
&lt;li&gt;Oranges&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Numbered list&lt;/strong&gt; — use numbers followed by a period:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;1.&lt;/span&gt; Wake up
&lt;span class="p"&gt;2.&lt;/span&gt; Make coffee
&lt;span class="p"&gt;3.&lt;/span&gt; Write code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Wake up&lt;/li&gt;
&lt;li&gt;Make coffee&lt;/li&gt;
&lt;li&gt;Write code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; You don't need to get the numbers exactly right — Markdown will re-number them for you automatically. Typing &lt;code&gt;1.&lt;/code&gt; three times in a row still produces &lt;code&gt;1, 2, 3&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Links
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Click here to visit Google&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://www.google.com&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.google.com" rel="noopener noreferrer"&gt;Click here to visit Google&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pattern is always: &lt;strong&gt;square brackets&lt;/strong&gt; for the text people see, then &lt;strong&gt;parentheses&lt;/strong&gt; right after for the actual web address — no space in between.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;text people see&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://the-actual-link.com&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  7. Images
&lt;/h2&gt;

&lt;p&gt;Images work almost exactly like links, but with an &lt;code&gt;!&lt;/code&gt; in front:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;![&lt;/span&gt;&lt;span class="nv"&gt;A cute dog&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://example.com/dog.jpg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The text inside the square brackets (&lt;code&gt;A cute dog&lt;/code&gt;) is the "alt text" — a short description shown if the image can't load, and used by screen readers for accessibility.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Inline code&lt;/strong&gt; (for a single word or short snippet) — wrap it in single backticks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Use the &lt;span class="sb"&gt;`console.log()`&lt;/span&gt; function to print something.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;p&gt;Use the &lt;code&gt;console.log()&lt;/code&gt; function to print something.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code blocks&lt;/strong&gt; (for multiple lines of code) — wrap the whole block in three backticks, with the language name right after the first set of backticks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;```&lt;/span&gt;&lt;span class="nl"&gt;javascript
&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&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;Renders as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&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;Adding the language name (like &lt;code&gt;javascript&lt;/code&gt;, &lt;code&gt;python&lt;/code&gt;, or &lt;code&gt;html&lt;/code&gt;) after the first three backticks tells Markdown to add color-coded syntax highlighting.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Blockquotes
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;&amp;gt;&lt;/code&gt; at the start of a line to quote something:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gt"&gt;&amp;gt; This is a quote.&lt;/span&gt;
&lt;span class="gt"&gt;&amp;gt; It can span multiple lines.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is a quote.&lt;br&gt;
It can span multiple lines.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is commonly used to highlight a note, a quote from someone, or a warning.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Tables
&lt;/h2&gt;

&lt;p&gt;Tables use pipes (&lt;code&gt;|&lt;/code&gt;) to separate columns and dashes (&lt;code&gt;-&lt;/code&gt;) to separate the header row from the data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;| Name  | Age | City     |
|-------|-----|----------|
| Sam   | 25  | Boston   |
| Alex  | 30  | New York |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Age&lt;/th&gt;
&lt;th&gt;City&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Sam&lt;/td&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;Boston&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alex&lt;/td&gt;
&lt;td&gt;30&lt;/td&gt;
&lt;td&gt;New York&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; The dashes don't need to line up perfectly — even &lt;code&gt;|-|-|-|&lt;/code&gt; works. Markdown figures out the columns from the pipes.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Horizontal Line
&lt;/h2&gt;

&lt;p&gt;Three or more dashes (or asterisks) on their own line create a horizontal divider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;---
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as a line separating sections — useful for splitting up parts of a long document (you've seen several of these already in this post).&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Line Breaks (a Common Gotcha)
&lt;/h2&gt;

&lt;p&gt;This trips up almost everyone starting out: pressing Enter &lt;strong&gt;once&lt;/strong&gt; in Markdown does &lt;strong&gt;not&lt;/strong&gt; create a new line when rendered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;This is line one.
This is line two.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Renders as:&lt;/p&gt;

&lt;p&gt;This is line one.&lt;br&gt;
This is line two.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(They get squished onto one line!)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To force a real line break, either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leave a &lt;strong&gt;completely empty line&lt;/strong&gt; between them (this starts a new paragraph), or&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;two spaces&lt;/strong&gt; at the end of a line before pressing Enter.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;This is line one.

This is line two.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This renders as two separate paragraphs, properly spaced apart.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Where Markdown Is Used
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub / GitLab&lt;/strong&gt; — README files, issues, pull request descriptions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation sites&lt;/strong&gt; — many docs are written and generated from &lt;code&gt;.md&lt;/code&gt; files&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Note-taking apps&lt;/strong&gt; — Notion, Obsidian, and many others support Markdown&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chat apps&lt;/strong&gt; — Discord and Slack use a simplified version of Markdown for bold/italic/code formatting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blogging platforms&lt;/strong&gt; — many static site generators (like Jekyll or Hugo) build entire websites from &lt;code&gt;.md&lt;/code&gt; files&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  14. Quick Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What you type&lt;/th&gt;
&lt;th&gt;What you get&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;# Text&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Heading&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;**Text**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Bold&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;*Text*&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Italic&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;- Text&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bullet point&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;1. Text&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Numbered item&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[Text](url)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Link&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;![Alt](url)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Image&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;`Text`&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inline code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 &lt;code&gt;```code```&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 | Code block |&lt;br&gt;
| &lt;code&gt;&amp;gt; Text&lt;/code&gt; | Blockquote |&lt;br&gt;
| &lt;code&gt;\| col \| col \|&lt;/code&gt; | Table |&lt;br&gt;
| &lt;code&gt;---&lt;/code&gt; | Horizontal line |&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The big idea:&lt;/strong&gt; Markdown lets you format text using a handful of simple, memorable symbols — no toolbar, no mouse, no fuss. Once you learn the dozen or so symbols in the table above, you can write clean, formatted documents anywhere Markdown is supported.&lt;/p&gt;

</description>
      <category>markdown</category>
      <category>github</category>
      <category>developers</category>
      <category>obsidian</category>
    </item>
    <item>
      <title>References in JavaScript</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Thu, 27 Aug 2026 15:46:13 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/references-in-javascript-1d25</link>
      <guid>https://dev.to/ragul_kannadasan/references-in-javascript-1d25</guid>
      <description>&lt;h2&gt;
  
  
  The Basic Idea
&lt;/h2&gt;

&lt;p&gt;Think of a variable like a &lt;strong&gt;name tag&lt;/strong&gt; stuck on a value.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple values (numbers, strings, true/false) — each variable gets its &lt;strong&gt;own separate value&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Objects and arrays — variables can &lt;strong&gt;share the same value&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's really the whole concept. Everything else is just examples of this playing out.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Simple Values Are Independent
&lt;/h2&gt;

&lt;p&gt;Numbers, strings, and booleans are "simple" (also called primitive) values. When you copy them into a new variable, you get a &lt;strong&gt;totally separate copy&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;age1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&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;age2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;age1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// age2 gets its own copy of the number 5&lt;/span&gt;

&lt;span class="nx"&gt;age2&lt;/span&gt; &lt;span class="o"&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;// change age2 only&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;age1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 5   &amp;lt;- did not change&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;age2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Changing &lt;code&gt;age2&lt;/code&gt; never touches &lt;code&gt;age1&lt;/code&gt;. They're two separate values now, even though they started out equal.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Objects and Arrays Can Be Shared
&lt;/h2&gt;

&lt;p&gt;Objects and arrays work differently. When you copy them into a new variable, you're &lt;strong&gt;not&lt;/strong&gt; making a new object — you're just giving the &lt;em&gt;same&lt;/em&gt; object a second name tag.&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;cart1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&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;cart2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cart1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// cart2 is just another name for the SAME object&lt;/span&gt;

&lt;span class="nx"&gt;cart2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt; &lt;span class="o"&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;// change it using cart2&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;cart1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10   &amp;lt;- cart1 changed too!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;cart1&lt;/code&gt; and &lt;code&gt;cart2&lt;/code&gt; are pointing at the exact same object. Change it through one name, and it shows up through the other name too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simple rule:&lt;/strong&gt; primitives copy the value. Objects copy the &lt;em&gt;pointer&lt;/em&gt; to the value.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. What This Means Inside Functions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;If you reassign a parameter&lt;/strong&gt; inside a function, it never affects the original variable — this is true for everything, even objects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;setToHundred&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// this only changes the LOCAL copy inside the function&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;myNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;setToHundred&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myNumber&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;myNumber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// still 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;But if you mutate (edit) an object's property&lt;/strong&gt; inside a function, the original object changes too — because it's the same object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;setToHundred&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// this edits the SHARED object, not a copy&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;myPerson&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nf"&gt;setToHundred&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myPerson&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;myPerson&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 100  &amp;lt;- it changed!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reassigning &lt;code&gt;=&lt;/code&gt; a whole variable → stays local, doesn't leak out.&lt;/li&gt;
&lt;li&gt;Editing a property on an object → changes the real object everywhere.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Comparing Objects
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;===&lt;/code&gt; checks whether two things are the &lt;em&gt;exact same object&lt;/em&gt; in memory — not whether they look the same.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({}&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="p"&gt;{});&lt;/span&gt; &lt;span class="c1"&gt;// false  &amp;lt;- two different empty objects&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt; &lt;span class="c1"&gt;// false  &amp;lt;- same reason, two different arrays&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;box1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;size&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;box2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;box1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// same box, two names&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;box1&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;box2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true  &amp;lt;- same object&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>if Statements in JavaScript</title>
      <dc:creator>Ragul</dc:creator>
      <pubDate>Wed, 26 Aug 2026 17:31:01 +0000</pubDate>
      <link>https://dev.to/ragul_kannadasan/if-statements-in-javascript-57cg</link>
      <guid>https://dev.to/ragul_kannadasan/if-statements-in-javascript-57cg</guid>
      <description>&lt;h1&gt;
  
  
  1. if
&lt;/h1&gt;

&lt;p&gt;Use the JavaScript if statement to execute a block of code when a condition is true.&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;//  block of code to be executed if the condition is true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You can drive!&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  2. Nested if
&lt;/h1&gt;

&lt;p&gt;You can use an if statement inside another if statement:&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;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&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;country&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;India&lt;/span&gt;&lt;span class="dl"&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;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You can Not drive!&lt;/span&gt;&lt;span class="dl"&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;country&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;India&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You can drive!&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nested if statements can make your code more complex.A better solution is to use the logical AND operator:&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;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&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;country&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;India&lt;/span&gt;&lt;span class="dl"&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;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You can Not drive!&lt;/span&gt;&lt;span class="dl"&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;country&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;India&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You can drive!&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  3. The else Statement
&lt;/h1&gt;

&lt;p&gt;Use the else statement to specify a block of code to be executed if a condition is false.&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;//  block of code to be executed if the condition is true&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="c1"&gt;//  block of code to be executed if the condition is false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You can drive!&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="k"&gt;else&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You can Not drive!&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  4. The else if Statement
&lt;/h1&gt;

&lt;p&gt;Use the else if statement to specify a new condition if the first is false.&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;condition1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;//  block of code to be executed if condition1 is true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;condition2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;//  block of code to be executed if the condition1 is false and condition2 is true&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="c1"&gt;//  block of code to be executed if the condition1 is false and condition2 is false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Good morning&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="k"&gt;else&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;time&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Good day&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="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Good evening&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>interview</category>
    </item>
  </channel>
</rss>
