<?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>Popcorn Movies and TV</title>
    <description>The most recent home feed on Popcorn Movies and TV.</description>
    <link>https://popcorn.forem.com</link>
    <atom:link rel="self" type="application/rss+xml" href="https://popcorn.forem.com/feed"/>
    <language>en</language>
    <item>
      <title>Synchronous vs Asynchronous JavaScript</title>
      <dc:creator>Pratham</dc:creator>
      <pubDate>Sun, 10 May 2026 10:53:26 +0000</pubDate>
      <link>https://popcorn.forem.com/pratham69/synchronous-vs-asynchronous-javascript-4933</link>
      <guid>https://popcorn.forem.com/pratham69/synchronous-vs-asynchronous-javascript-4933</guid>
      <description>&lt;p&gt;&lt;em&gt;Why JavaScript doesn't just wait around — and how that changes everything about how you write code.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Let me tell you about the moment asynchronous JavaScript broke my brain.&lt;/p&gt;

&lt;p&gt;I wrote this code, fully expecting it to print in order:&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;First&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="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;Second&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="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;Third&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;I expected: First → Second → Third.&lt;/p&gt;

&lt;p&gt;I got: First → Third → Second.&lt;/p&gt;

&lt;p&gt;Zero milliseconds of delay, and "Second" &lt;em&gt;still&lt;/em&gt; printed last. I stared at my screen thinking JavaScript was broken. It wasn't. I just didn't understand how JavaScript handles time.&lt;/p&gt;

&lt;p&gt;This is the story of &lt;strong&gt;synchronous vs asynchronous&lt;/strong&gt; code, and once you get it, a massive amount of JavaScript behavior suddenly makes sense. Let me walk you through it the way it finally clicked for me in the ChaiCode Web Dev Cohort 2026.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Does Synchronous Code Mean?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Synchronous&lt;/strong&gt; means "one thing at a time, in order." Each line waits for the previous line to finish before it starts.&lt;/p&gt;

&lt;p&gt;Think of it like a single-lane road. Only one car can pass at a time. If the car in front stops, everyone behind it waits.&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;Step 1: Wake up&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Step 2: Brush teeth&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Step 3: Make coffee&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Step 4: Start coding&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;Step 1: Wake up
Step 2: Brush teeth
Step 3: Make coffee
Step 4: Start coding
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each line runs, finishes, and &lt;em&gt;then&lt;/em&gt; the next one starts. Predictable. Linear. No surprises.&lt;/p&gt;

&lt;h3&gt;
  
  
  Synchronous Execution Timeline
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Time →
─────────────────────────────────────────────────

  Step 1       Step 2       Step 3       Step 4
  ┌─────┐     ┌─────┐     ┌─────┐     ┌─────┐
  │Wake │ ──→ │Brush│ ──→ │Make │ ──→ │Code │
  │ up  │     │teeth│     │coffee│    │     │
  └─────┘     └─────┘     └─────┘     └─────┘

Each task COMPLETES before the next one STARTS.
Nothing runs in parallel.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how JavaScript works by default. It's a &lt;strong&gt;single-threaded&lt;/strong&gt; language — it has one call stack, one thread, and it processes one operation at a time.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: Blocking Code
&lt;/h2&gt;

&lt;p&gt;Synchronous execution works perfectly until you hit a task that takes &lt;em&gt;time&lt;/em&gt;. Not a millisecond — real time. Seconds. Maybe longer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-World Example: Waiting for Data
&lt;/h3&gt;

&lt;p&gt;Imagine you're building a web app. You need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Show a loading message&lt;/li&gt;
&lt;li&gt;Fetch user data from an API (takes 2–3 seconds)&lt;/li&gt;
&lt;li&gt;Display the user data&lt;/li&gt;
&lt;li&gt;Show other page content&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If everything is synchronous:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Time →
─────────────────────────────────────────────────

  Show        Fetch data       Display      Show
  loading     (waiting...)     user data    content
  ┌─────┐    ┌────────────────┐ ┌─────┐    ┌─────┐
  │     │ ──→│  2-3 SECONDS   │→│     │ ──→│     │
  │     │    │  EVERYTHING    │ │     │    │     │
  │     │    │  IS FROZEN     │ │     │    │     │
  └─────┘    └────────────────┘ └─────┘    └─────┘
                     ↑
              BLOCKING! 🚫
              Nothing else can run while waiting.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire page &lt;strong&gt;freezes&lt;/strong&gt;. The user can't scroll, can't click, can't do anything. The UI is unresponsive for 2–3 seconds. That's a terrible user experience.&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;blocking&lt;/strong&gt; — one slow task blocks everything else from running.&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Example of Blocking
&lt;/h3&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;Page is loading...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Simulating a blocking operation (DON'T do this in real code)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Busy-wait for 3 seconds — blocks EVERYTHING&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;Data loaded!&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Showing rest of the page&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;During those 3 seconds, JavaScript can't do &lt;em&gt;anything&lt;/em&gt; else. No animations, no button clicks, no rendering. The browser might even show the "page unresponsive" dialog.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Does Asynchronous Code Mean?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Asynchronous&lt;/strong&gt; means "start a task, move on, and come back to it when it's done." You don't wait — you continue doing other things.&lt;/p&gt;

&lt;p&gt;Think of it like ordering food at a restaurant. You place your order and then &lt;em&gt;continue your conversation&lt;/em&gt; while the kitchen prepares the food. When the food is ready, the waiter brings it to you. You didn't freeze in silence staring at the kitchen door for 20 minutes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SYNCHRONOUS (blocking):
  You order → you STARE at the kitchen → food arrives → you eat → you talk

ASYNCHRONOUS (non-blocking):
  You order → you TALK while kitchen cooks → food arrives → you eat
  (you didn't waste time waiting)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In JavaScript, asynchronous code lets you say: "Start this task. I'll keep running other code. Call me when you're done."&lt;/p&gt;




&lt;h2&gt;
  
  
  Why JavaScript Needs Asynchronous Behavior
&lt;/h2&gt;

&lt;p&gt;JavaScript runs in the browser. Browsers need to do a &lt;em&gt;lot&lt;/em&gt; at the same time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Respond to user clicks&lt;/li&gt;
&lt;li&gt;Render animations smoothly (60 fps)&lt;/li&gt;
&lt;li&gt;Fetch data from APIs&lt;/li&gt;
&lt;li&gt;Run your JavaScript code&lt;/li&gt;
&lt;li&gt;Update the DOM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If JavaScript blocked on every slow operation, the browser would freeze constantly. That's unacceptable for a web environment. So JavaScript uses an &lt;strong&gt;asynchronous model&lt;/strong&gt; to handle time-consuming tasks without freezing the main thread.&lt;/p&gt;

&lt;p&gt;The slow tasks get &lt;em&gt;offloaded&lt;/em&gt;. While they're being processed elsewhere (by the browser, the network, the filesystem), JavaScript keeps running the rest of your code. When the slow task finishes, a callback is queued up and JavaScript processes it when it's free.&lt;/p&gt;




&lt;h2&gt;
  
  
  Asynchronous Examples: Timers and API Calls
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;setTimeout&lt;/code&gt; — The Simplest Async Example
&lt;/h3&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;Start&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;This runs after 2 seconds&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;2000&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;End&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;Start
End
This runs after 2 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait — "End" printed &lt;em&gt;before&lt;/em&gt; the timeout message, even though the timeout line comes first in the code! Here's why:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;console.log("Start")&lt;/code&gt; runs immediately.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setTimeout&lt;/code&gt; registers the callback and says "run this after 2 seconds." JavaScript &lt;strong&gt;doesn't wait&lt;/strong&gt; — it moves on.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;console.log("End")&lt;/code&gt; runs immediately.&lt;/li&gt;
&lt;li&gt;After 2 seconds, the callback fires: &lt;code&gt;console.log("This runs after 2 seconds")&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Zero-Delay Mystery (Explained!)
&lt;/h3&gt;

&lt;p&gt;Remember my opening example?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="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;First&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="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;Second&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="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;Third&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: First → Third → Second.&lt;/p&gt;

&lt;p&gt;Even with 0 milliseconds delay, the callback doesn't run immediately. It gets placed in the &lt;strong&gt;task queue&lt;/strong&gt; and only executes &lt;em&gt;after&lt;/em&gt; all synchronous code has finished. JavaScript always finishes what's on its plate before checking the queue.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;setInterval&lt;/code&gt; — Repeat at Intervals
&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;0&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;timer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;setInterval&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;count&lt;/span&gt;&lt;span class="o"&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;`Tick &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="k"&gt;if &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="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;clearInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timer&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;Timer stopped.&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;span class="mi"&gt;1000&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;Timer started — code continues running...&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;Timer started — code continues running...
Tick 1       (after 1 second)
Tick 2       (after 2 seconds)
Tick 3       (after 3 seconds)
Timer stopped.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code &lt;em&gt;after&lt;/em&gt; &lt;code&gt;setInterval&lt;/code&gt; runs immediately. The ticks happen in the background.&lt;/p&gt;

&lt;h3&gt;
  
  
  API Calls with &lt;code&gt;fetch&lt;/code&gt; (Preview)
&lt;/h3&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;Fetching user data...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://jsonplaceholder.typicode.com/users/1&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;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;response&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;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;user&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="s2"&gt;`User: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This runs while fetch is working...&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;Fetching user data...
This runs while fetch is working...
User: Leanne Graham       (arrives later)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;fetch&lt;/code&gt; doesn't block. It fires the request, and JavaScript keeps going. When the response comes back, the &lt;code&gt;.then()&lt;/code&gt; callback handles it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Asynchronous Task Queue Concept
&lt;/h2&gt;

&lt;p&gt;Here's the mental model that ties everything together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────────────────────────┐
│                   Call Stack                          │
│           (synchronous code runs here)               │
│                                                      │
│   console.log("Start")  ← runs immediately           │
│   setTimeout(cb, 2000)  ← registers callback, moves on│
│   console.log("End")    ← runs immediately           │
│                                                      │
└──────────────────────────┬───────────────────────────┘
                           │
              "Is the call stack empty?"
                           │
                    YES ↓  NO → keep running
                           │
┌──────────────────────────┴───────────────────────────┐
│                   Task Queue                          │
│        (async callbacks wait here)                   │
│                                                      │
│   [callback from setTimeout]  ← waiting...           │
│                                                      │
│   When call stack is empty, this moves up ↑           │
└──────────────────────────────────────────────────────┘

The EVENT LOOP continuously checks:
  "Is the call stack empty? If yes, take the next task
   from the queue and put it on the stack."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step-by-Step Trace
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Code&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;A&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="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;B&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="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;C&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;Step&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;Call&lt;/span&gt; &lt;span class="nx"&gt;Stack&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;A&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;     &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;prints&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;A&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;Step&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nx"&gt;Call&lt;/span&gt; &lt;span class="nx"&gt;Stack&lt;/span&gt;&lt;span class="p"&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="nx"&gt;cb&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="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;registers&lt;/span&gt; &lt;span class="nx"&gt;cb&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;removed&lt;/span&gt;
         &lt;span class="nx"&gt;Task&lt;/span&gt; &lt;span class="nx"&gt;Queue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;cb&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;Step&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nx"&gt;Call&lt;/span&gt; &lt;span class="nx"&gt;Stack&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;C&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;     &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;prints&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;C&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;Step&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nx"&gt;Call&lt;/span&gt; &lt;span class="nx"&gt;Stack&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;EMPTY&lt;/span&gt;
         &lt;span class="nx"&gt;Event&lt;/span&gt; &lt;span class="nx"&gt;Loop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Stack empty? Yes → move cb from queue to stack&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;Step&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;Call&lt;/span&gt; &lt;span class="nx"&gt;Stack&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;B&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;     &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;prints&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;B&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="nx"&gt;Output&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;C&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;B&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is why "B" prints last even with a 0ms delay. The callback &lt;em&gt;always&lt;/em&gt; waits for all synchronous code to finish before it can run.&lt;/p&gt;




&lt;h2&gt;
  
  
  Synchronous vs Asynchronous — Side by Side
&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;Synchronous&lt;/th&gt;
&lt;th&gt;Asynchronous&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Execution&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One at a time, in order&lt;/td&gt;
&lt;td&gt;Start task, move on, handle result later&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Blocking?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ Yes — waits for each task&lt;/td&gt;
&lt;td&gt;❌ No — moves on immediately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;UI impact&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Can freeze the page&lt;/td&gt;
&lt;td&gt;Keeps the page responsive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use case&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Simple calculations, variable assignment&lt;/td&gt;
&lt;td&gt;API calls, timers, file reads, user events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Code complexity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Simple, linear&lt;/td&gt;
&lt;td&gt;Requires callbacks, promises, or async/await&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;let x = 1 + 2;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fetch(url).then(...)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Everyday Analogy
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SYNCHRONOUS — doing laundry the blocking way:
  1. Put clothes in washer → WAIT 45 min → done
  2. Move to dryer → WAIT 60 min → done
  3. Fold clothes → done
  Total: You did NOTHING else for 2 hours.

ASYNCHRONOUS — doing laundry the smart way:
  1. Put clothes in washer → go cook dinner
  2. Washer beeps → move to dryer → go read a book
  3. Dryer beeps → fold clothes
  Total: You cooked dinner AND read a book while waiting.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Problems That Occur with Blocking Code
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Frozen UI
&lt;/h3&gt;

&lt;p&gt;If JavaScript is busy with a synchronous task, the browser can't update the screen, respond to clicks, or animate anything. Users see a frozen, unresponsive page.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Poor User Experience
&lt;/h3&gt;

&lt;p&gt;Nobody wants to wait 3 seconds staring at a blank screen while data loads. Async code lets you show loading spinners, skeleton screens, or partial content while data arrives.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Timeouts and Failures
&lt;/h3&gt;

&lt;p&gt;Synchronous network requests (which are deprecated for good reason) would freeze the browser until the server responds — or until the request times out, leaving the user stuck.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Wasted Resources
&lt;/h3&gt;

&lt;p&gt;A single-threaded language that blocks means the CPU is idle during I/O waits. Async code lets the CPU do useful work while waiting for slow operations to complete.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's Practice: Hands-On Assignment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Part 1: Predict the Output
&lt;/h3&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;1&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="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;2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1000&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;3&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="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;4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="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;5&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;&lt;strong&gt;Answer:&lt;/strong&gt; &lt;code&gt;1, 3, 5, 4, 2&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;1&lt;/code&gt;, &lt;code&gt;3&lt;/code&gt;, &lt;code&gt;5&lt;/code&gt; are synchronous — they run immediately in order.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;4&lt;/code&gt; has 0ms delay but still waits for synchronous code to finish.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;2&lt;/code&gt; has 1000ms delay — runs last.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Part 2: Simulate Async Data Loading
&lt;/h3&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;📡 Fetching user data...&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&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;Pratham&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;developer&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="s2"&gt;`✅ User loaded: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&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="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;role&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="mi"&gt;2000&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;⏳ Meanwhile, showing the rest of the page...&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;📰 News section loaded.&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;📊 Dashboard widgets loaded.&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;📡 Fetching user data...
⏳ Meanwhile, showing the rest of the page...
📰 News section loaded.
📊 Dashboard widgets loaded.
✅ User loaded: Pratham (developer)   ← arrives 2 seconds later
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Part 3: Experience Blocking vs Non-Blocking
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Blocking version — freezes everything for 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;Start (blocking)&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;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// busy wait&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;End (blocking)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// prints after 3 seconds of freezing&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Non-blocking version — doesn't freeze anything&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;Start (non-blocking)&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;End (non-blocking)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// prints after 3 seconds, but nothing froze&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="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;Still running other code!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// prints immediately&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Synchronous&lt;/strong&gt; code runs one line at a time, in order. Each line waits for the previous one to finish. Simple but potentially blocking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asynchronous&lt;/strong&gt; code starts a task and moves on. The result is handled later via callbacks, promises, or async/await. Non-blocking.&lt;/li&gt;
&lt;li&gt;JavaScript is &lt;strong&gt;single-threaded&lt;/strong&gt; but uses an &lt;strong&gt;event loop&lt;/strong&gt; and &lt;strong&gt;task queue&lt;/strong&gt; to handle async operations without blocking the main thread.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blocking code&lt;/strong&gt; freezes the UI, wastes CPU time, and creates terrible user experiences. Async code keeps everything responsive.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setTimeout&lt;/code&gt;, &lt;code&gt;fetch&lt;/code&gt;, event listeners, and file I/O are all asynchronous — they register callbacks that execute &lt;em&gt;after&lt;/em&gt; all synchronous code finishes.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Understanding the difference between synchronous and asynchronous JavaScript is one of the most important mental shifts you'll make as a developer. Once you see that JavaScript doesn't "wait" for slow tasks — it moves on and comes back later — a huge amount of confusing behavior starts making sense. The order of &lt;code&gt;console.log&lt;/code&gt; outputs, how &lt;code&gt;fetch&lt;/code&gt; works, why your data is &lt;code&gt;undefined&lt;/code&gt; before the API responds — it all clicks.&lt;/p&gt;

&lt;p&gt;I'm working through all of this in the &lt;strong&gt;ChaiCode Web Dev Cohort 2026&lt;/strong&gt; under Hitesh Chaudhary and Piyush Garg. This article is the foundation — next comes promises, async/await, and the full event loop picture. But understanding sync vs async first makes everything that follows much easier.&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.linkedin.com/in/pratham16" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; or visit &lt;a href="https://prathamdev.in" rel="noopener noreferrer"&gt;PrathamDEV.in&lt;/a&gt;. More articles coming as the journey continues.&lt;/p&gt;

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




&lt;p&gt;&lt;em&gt;Written by Pratham Bhardwaj | Web Dev Cohort 2026, ChaiCode&lt;/em&gt;&lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Coding Cat Oran S2 Ep1 — The Excel Republic</title>
      <dc:creator>SysLayer</dc:creator>
      <pubDate>Sun, 10 May 2026 10:51:45 +0000</pubDate>
      <link>https://popcorn.forem.com/syslayer/coding-cat-oran-s2-ep1-the-excel-republic-5g15</link>
      <guid>https://popcorn.forem.com/syslayer/coding-cat-oran-s2-ep1-the-excel-republic-5g15</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foucfi2z8dc777gr69ool.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foucfi2z8dc777gr69ool.png" alt=" " width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A story about trial production, three departments, and three versions of the truth.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;It's 7am on the production floor.&lt;/p&gt;

&lt;p&gt;Three people are standing around a whiteboard.&lt;br&gt;
One is from QA. One is from Engineering. One is from Manufacturing.&lt;br&gt;
They are arguing about a number.&lt;/p&gt;

&lt;p&gt;The number is the yield rate for Product A, Batch 7, last Tuesday.&lt;/p&gt;

&lt;p&gt;QA says: &lt;strong&gt;87%.&lt;/strong&gt;&lt;br&gt;
Engineering says: &lt;strong&gt;91%.&lt;/strong&gt;&lt;br&gt;
Manufacturing says: &lt;em&gt;"Depends on which shift."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;All three are holding laptops.&lt;br&gt;
All three are looking at Excel files.&lt;br&gt;
All three are right.&lt;/p&gt;



&lt;p&gt;Oran is an orange cat. No CS degree.&lt;br&gt;
He learned to code at night, online, on his own time,&lt;br&gt;
with AI tools and courses he bought on sale.&lt;/p&gt;

&lt;p&gt;He got hired anyway. It's that kind of year.&lt;/p&gt;

&lt;p&gt;His job title is IT. His actual job is: whatever nobody else wants to do.&lt;/p&gt;

&lt;p&gt;This week, his job is to &lt;em&gt;reconcile the production data.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;He sits down. He opens all three Excel files.&lt;/p&gt;

&lt;p&gt;The columns have different names.&lt;br&gt;
The formulas have different logic.&lt;br&gt;
The defect definitions are different.&lt;br&gt;
QA counts a scratch as a defect. Manufacturing counts it as cosmetic. Engineering doesn't count it at all unless it affects function.&lt;/p&gt;

&lt;p&gt;Same scratch. Three categories. Three numbers.&lt;/p&gt;

&lt;p&gt;Oran closes his laptop.&lt;br&gt;
He stares at the ceiling for a long time.&lt;/p&gt;



&lt;p&gt;Here is what Oran understands, sitting in that chair:&lt;/p&gt;

&lt;p&gt;The data problem is not a data problem.&lt;/p&gt;

&lt;p&gt;It's a &lt;strong&gt;political problem dressed as a data problem.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each department's Excel file is their scoreboard.&lt;br&gt;
Their evidence. Their alibi.&lt;br&gt;
If QA's numbers are the official numbers, QA controls the narrative.&lt;br&gt;
If Engineering's numbers are official, Engineering does.&lt;br&gt;
If they merge into one system, someone's score gets worse.&lt;/p&gt;

&lt;p&gt;Nobody built these spreadsheets to hide information.&lt;br&gt;
They built them to protect themselves.&lt;br&gt;
That's different. And it's harder to fix.&lt;/p&gt;



&lt;p&gt;Oran opens a blank document.&lt;/p&gt;

&lt;p&gt;He doesn't start with a database schema.&lt;br&gt;
He doesn't start with a system architecture.&lt;br&gt;
He starts with a question:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What would it mean for all three of these numbers to be correct at the same time?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;He writes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inspection timing&lt;/strong&gt; is different. QA measures at end-of-line. Engineering measures at each station. Manufacturing measures at shipment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Defect scope&lt;/strong&gt; is different. Three departments, three definitions, never written down anywhere.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The data is collected by different people, at different times, with different tools, for different audiences.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One batch. One production run. Six data points that look like contradictions but are actually just context.&lt;/p&gt;

&lt;p&gt;The problem isn't that the data is wrong.&lt;br&gt;
The problem is that there's no single place that holds all of it together.&lt;/p&gt;



&lt;p&gt;That evening, Oran writes the first three lines of what will eventually become a database schema.&lt;/p&gt;

&lt;p&gt;He doesn't know that yet.&lt;br&gt;
He thinks he's just taking notes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- What actually happened&lt;/span&gt;
&lt;span class="c1"&gt;-- Who was there&lt;/span&gt;
&lt;span class="c1"&gt;-- When&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;He looks at the three Excel files one more time.&lt;/p&gt;

&lt;p&gt;Then he writes a fourth line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- And what "defect" means in this context&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;em&gt;There were three versions of the truth.&lt;br&gt;
Everyone was lying. No one was wrong.&lt;br&gt;
The database didn't exist yet.&lt;br&gt;
But the problem did.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>cim</category>
      <category>database</category>
      <category>dataclean</category>
    </item>
    <item>
      <title>Learning Xahau: Debunking Common Myths About Xahau</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Sun, 10 May 2026 10:50:31 +0000</pubDate>
      <link>https://popcorn.forem.com/ekiserrepe/learning-xahau-debunking-common-myths-about-xahau-1eke</link>
      <guid>https://popcorn.forem.com/ekiserrepe/learning-xahau-debunking-common-myths-about-xahau-1eke</guid>
      <description>&lt;p&gt;If you spend enough time reading discussions about Xahau, you’ll quickly notice that many people talk about the blockchain and its capabilities without fully understanding how it actually works.&lt;/p&gt;

&lt;p&gt;The rise of AI-generated content, combined with the lack of deep technical research in many online discussions, has created an environment where misinformation spreads extremely fast. Over the last few months, I’ve repeatedly seen the same myths, misunderstandings, and inaccurate comparisons appear across social media.&lt;/p&gt;

&lt;p&gt;So I decided to write this article to help clarify some of the most common misconceptions surrounding Xahau.&lt;/p&gt;

&lt;p&gt;If you want to learn more about Xahau, I also recommend checking out the rest of the &lt;strong&gt;Learning Xahau&lt;/strong&gt; &lt;a href="https://dev.to/ekiserrepe/series/31668"&gt;series&lt;/a&gt;, where I share information about the ecosystem, automation concepts, development ideas, and practical use cases for builders interested in working with Xahau.&lt;/p&gt;

&lt;p&gt;Today, however, we’re going to focus on breaking down some of the most common myths I’ve encountered online.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. “Xahau Is an XRP Ledger Sidechain”
&lt;/h1&gt;

&lt;p&gt;This is probably the most repeated myth.&lt;/p&gt;

&lt;p&gt;XRP Ledger and Xahau share technological origins, but Xahau is &lt;strong&gt;not&lt;/strong&gt; a native sidechain connected to the XRP Ledger.&lt;/p&gt;

&lt;p&gt;Xahau is an independent &lt;strong&gt;Layer 1 blockchain&lt;/strong&gt; built from a fork of XRPL code that evolved in a completely different direction.&lt;/p&gt;

&lt;p&gt;That means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Xahau has its own validators&lt;/li&gt;
&lt;li&gt;Xahau has its own native asset: &lt;strong&gt;XAH&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Xahau has its own governance and technical evolution&lt;/li&gt;
&lt;li&gt;XRPL amendments do &lt;strong&gt;not&lt;/strong&gt; automatically appear on Xahau&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both networks may occasionally adopt ideas from one another, but they evolve independently.&lt;/p&gt;

&lt;p&gt;There are features available on XRP Ledger that do not exist on Xahau, and there are features on Xahau that do not exist on XRP Ledger.&lt;/p&gt;

&lt;p&gt;Part of the &lt;em&gt;sidechain&lt;/em&gt; confusion comes from the early history of the project.&lt;/p&gt;

&lt;p&gt;In the beginning, Xahau was actually described as a sidechain, including in early versions of its whitepaper. At that time, there was a &lt;a href="https://xahau.network/docs/features/burn-2-mint/" rel="noopener noreferrer"&gt;mechanism&lt;/a&gt; where XRP could be burned on the XRP Ledger and converted into XAH on the Xahau blockchain. However, that process was eventually closed. Once that bridge mechanism disappeared, the term “sidechain” no longer made technical sense.&lt;/p&gt;

&lt;p&gt;Today, Xahau operates as an independent Layer 1 blockchain, even though it still shares part of its original codebase heritage with XRP Ledger.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. “Projects Built on Xahau Don’t Actually Use XAH”
&lt;/h1&gt;

&lt;p&gt;This is another claim I’ve seen online that honestly surprised me.&lt;/p&gt;

&lt;p&gt;In many blockchain ecosystems, “adoption” often refers to companies using private versions of the technology, centralized services, or additional enterprise services offered by blockchain companies, while still presenting it publicly as if they were directly using the public blockchain itself. In some cases, the public chain or its native asset barely participates in the actual operation behind the scenes. Xahau works differently.&lt;/p&gt;

&lt;p&gt;To interact with the network, you need &lt;strong&gt;XAH&lt;/strong&gt;. Because XAH is the native asset required for network operation. XAH is a gas token.&lt;/p&gt;

&lt;p&gt;XAH is used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Account/Object reserves&lt;/li&gt;
&lt;li&gt;Transaction execution&lt;/li&gt;
&lt;li&gt;Hook interactions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is no artificial separation between “the technology” and “the public blockchain.” Xahau only makes sense if the blockchain itself is actively used.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. “Hooks Are Just Ethereum Smart Contracts”
&lt;/h1&gt;

&lt;p&gt;No. While both systems enable automation, the philosophy behind them is completely different.&lt;/p&gt;

&lt;p&gt;In Ethereum, smart contracts are typically full decentralized applications deployed directly on-chain. In Xahau, &lt;strong&gt;Hooks&lt;/strong&gt; are lightweight pieces of logic attached directly to accounts that react to specific ledger events.&lt;/p&gt;

&lt;p&gt;This creates a very different model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compact logic&lt;/li&gt;
&lt;li&gt;Deterministic behavior&lt;/li&gt;
&lt;li&gt;Native account integration&lt;/li&gt;
&lt;li&gt;Direct financial automation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hooks were never designed to replicate the EVM.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. “The XAH You See on XRPL Is Native XAH”
&lt;/h1&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;When you see XAH traded on the XRP Ledger DEX, you are usually seeing an &lt;strong&gt;IOU representation&lt;/strong&gt; of XAH, not native XAH itself.&lt;/p&gt;

&lt;p&gt;Even worse, multiple fake IOUs using the name “XAH” have appeared over time, created by scammers attempting to mislead users.&lt;/p&gt;

&lt;p&gt;At the moment, the main legitimate XAH IOU on XRPL is issued by Gatehub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Currency Code:&lt;/strong&gt; XAH&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Issuer:&lt;/strong&gt; &lt;code&gt;rswh1fvyLqHizBS2awu1vs6QcmwTBd9qiv&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Native XAH only exists directly on the Xahau blockchain. This is similar to how wrapped versions of BTC or ETH exist on other blockchains without being the native assets themselves.&lt;/p&gt;

&lt;p&gt;And this distinction matters because certain features only exist directly on Xahau, such as &lt;strong&gt;Balance Adjustment&lt;/strong&gt;, which currently provides around 4%.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. “Xahau Is Just XRP Ledger With Smart Contracts”
&lt;/h1&gt;

&lt;p&gt;That explanation is far too simplistic.&lt;/p&gt;

&lt;p&gt;Yes, Hooks are one of the biggest innovations introduced by Xahau. But Xahau also introduces new programmable dynamics and a different philosophy around financial automation.&lt;/p&gt;

&lt;p&gt;The goal is not simply to “add smart contracts.”&lt;/p&gt;

&lt;p&gt;The goal is to allow users to integrate custom business logic directly into the ledger itself. That fundamentally changes how financial systems can be automated.&lt;/p&gt;




&lt;h1&gt;
  
  
  6. “Hooks Are Dangerous Because They Can Do Anything”
&lt;/h1&gt;

&lt;p&gt;Actually, Hooks were specifically designed with limitations in mind. Strict execution limits and deterministic behavior exist precisely to avoid many of the problems seen in more open smart contract environments. Those limitations are not weaknesses. They are part of the design philosophy.&lt;/p&gt;

&lt;p&gt;Instead of allowing infinite complexity, Hooks prioritize:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Predictability&lt;/li&gt;
&lt;li&gt;Efficiency&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Low operational costs&lt;/li&gt;
&lt;li&gt;Native integration&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  7. “Xahau Depends on Ripple”
&lt;/h1&gt;

&lt;p&gt;Ripple does not own or control Xahau.&lt;/p&gt;

&lt;p&gt;Xahau emerged after years of research and development surrounding Hooks technology. Originally, Hooks were expected to become part of XRP Ledger itself. However, after significant pushback, the developers behind the Hooks project decided not to abandon years of work and instead launched an independent blockchain where Hooks could exist natively: Xahau.&lt;/p&gt;

&lt;p&gt;Like XRPL, Xahau is built using open-source technology and independent validators. Ripple has no governance control or any type of control over Xahau.&lt;/p&gt;

&lt;p&gt;Interestingly, it was later announced that a certain level of programmability would be introduced to the XRP Ledger, beginning with features such as Smart Escrows, expected around late 2025. As of May 2026, those features have still not arrived in production.&lt;/p&gt;




&lt;h1&gt;
  
  
  8. “Xahau Is Trying to Compete With Every Other Blockchain”
&lt;/h1&gt;

&lt;p&gt;The blockchain industry often frames everything as a constant war between ecosystems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One chain vs another&lt;/li&gt;
&lt;li&gt;One token vs another&lt;/li&gt;
&lt;li&gt;One community attacking another&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But Xahau does not necessarily need to operate under that mentality. Financial institutions are free to use whatever technologies they consider useful. And in reality, most companies rarely depend on a single infrastructure provider.&lt;/p&gt;

&lt;p&gt;An organization may simultaneously use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple blockchains&lt;/li&gt;
&lt;li&gt;Traditional banking systems&lt;/li&gt;
&lt;li&gt;Private infrastructure&lt;/li&gt;
&lt;li&gt;Internal automation tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Xahau does not need to “win” a blockchain war to be useful.&lt;/p&gt;

&lt;p&gt;There’s also an uncomfortable reality within this industry:&lt;/p&gt;

&lt;p&gt;Many blockchain companies directly or indirectly pay for institutional pilots and demonstrations through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PoCs&lt;/li&gt;
&lt;li&gt;Pilot programs&lt;/li&gt;
&lt;li&gt;Corporate demos&lt;/li&gt;
&lt;li&gt;Marketing partnerships&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And in many cases, those institutions never end up using the public blockchain or native token at all. Yet the announcements are still heavily promoted to generate speculation and marketing narratives. That creates enormous confusion within crypto communities.&lt;/p&gt;

&lt;p&gt;Xahau is attempting to follow a different philosophy. The goal is not to manufacture headlines. The goal is to build tools that can actually function in real regulatory and financial environments. And if institutions choose to combine Xahau with other technologies, they can. Because the objective is not to “win a competition.” The objective is to build useful technology.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Understanding Xahau requires looking beyond the usual blockchain narratives. Too often, people try to categorize every project using the same labels: Ethereum competitor, XRPL sidechain, smart contract platform, or DeFi chain. But Xahau was not designed to fit neatly into those categories. Its philosophy is different.&lt;/p&gt;

&lt;p&gt;Instead of chasing maximum complexity, Xahau focuses on making financial automation more integrated, predictable, and usable directly at the ledger level.&lt;/p&gt;

&lt;p&gt;Whether Xahau succeeds long term will ultimately depend on real adoption, real builders, and real utility, not marketing narratives or social media speculation.&lt;/p&gt;

&lt;p&gt;And that is probably the most important thing to understand about Xahau: the goal is not to imitate what already exists, but to explore a different way of building programmable financial systems.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>cryptocurrency</category>
      <category>learning</category>
      <category>web3</category>
    </item>
    <item>
      <title>Why Your RAG Chatbot Looks Great in Week 1 and Hallucinates by Month 2</title>
      <dc:creator>Akshay Kumar BM </dc:creator>
      <pubDate>Sun, 10 May 2026 10:43:34 +0000</pubDate>
      <link>https://popcorn.forem.com/akshay_kumar_bm/why-your-rag-chatbot-looks-great-in-week-1-and-hallucinates-by-month-2-52k5</link>
      <guid>https://popcorn.forem.com/akshay_kumar_bm/why-your-rag-chatbot-looks-great-in-week-1-and-hallucinates-by-month-2-52k5</guid>
      <description>&lt;p&gt;💡 Week 1 demo → "this is amazing."&lt;/p&gt;

&lt;p&gt;Month 2 production → "why is it hallucinating?"&lt;/p&gt;

&lt;p&gt;I've seen this pattern more times than I can count. The team builds a RAG chatbot. It works beautifully on the 20 questions they tested it with. They ship it. Real users show up with real questions. The cracks appear.&lt;/p&gt;

&lt;p&gt;The model is almost never the problem.&lt;/p&gt;

&lt;p&gt;The system around it is.&lt;/p&gt;

&lt;p&gt;After shipping 10+ production RAG systems — handling everything from 100 queries a day to 1,000+ a week at 95% accuracy — I've narrowed it down to four things that consistently separate the ones that keep working from the ones that quietly get abandoned.&lt;/p&gt;

&lt;p&gt;Here's what I follow on every build now.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Why RAG Fails in Production (It's Not the Model)
&lt;/h2&gt;

&lt;p&gt;Most teams build RAG like this:&lt;/p&gt;

&lt;p&gt;→ Grab the documents&lt;br&gt;
→ Chunk and embed them&lt;br&gt;
→ Add a retriever&lt;br&gt;
→ Write a prompt&lt;br&gt;
→ Ship it&lt;/p&gt;

&lt;p&gt;It works in the demo because the demo is a controlled environment. You know the questions. You've tested on a small, clean set of docs. The model looks smart.&lt;/p&gt;

&lt;p&gt;Production breaks this in three ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real users ask questions the team never anticipated.&lt;/strong&gt; The retriever pulls the wrong chunks. The model doesn't know it retrieved the wrong chunks. It answers anyway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The knowledge base is messier than it looked.&lt;/strong&gt; Confluence pages that conflict with each other. Slack threads that reference decisions never written down. Google Docs with five versions. The model retrieves all of it and synthesizes a "confident average" — which is a hallucination with citations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There's no feedback loop.&lt;/strong&gt; Nobody knows which answers are wrong until a user complains, by which point the damage is done.&lt;/p&gt;

&lt;p&gt;Research confirms this isn't a fringe problem: 40–60% of RAG implementations never make it to production at all. Of the ones that do, naive RAG — embed, retrieve top-k, prompt — consistently plateaus at 70–80% retrieval precision without additional structure around it.&lt;/p&gt;

&lt;p&gt;The fix isn't a better model. It's building the system properly.&lt;/p&gt;


&lt;h2&gt;
  
  
  🧠 Rule 1: Evals Before Prompts
&lt;/h2&gt;

&lt;p&gt;This is the highest-leverage thing I do on every RAG project, and it's the thing most teams skip.&lt;/p&gt;

&lt;p&gt;Before writing a single prompt, build a test set of 30–40 real questions with expected answers. Run every prompt change — every chunk size tweak, every retriever adjustment — against the full set.&lt;/p&gt;

&lt;p&gt;Without this, you're optimizing blind. You fix one question and break three others without knowing it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# eval_set.py — structure for a minimal RAG eval set
&lt;/span&gt;
&lt;span class="n"&gt;eval_set&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is our refund policy for enterprise customers?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_answer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enterprise customers get a 30-day money-back guarantee.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source_doc&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enterprise-policy-v3.md&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;policy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Who do I contact for billing issues?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_answer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;billing@company.com or the #billing Slack channel.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source_doc&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;support-contacts.md&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;contacts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="c1"&gt;# ... 30-40 total, covering every major topic area
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_eval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rag_chain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;eval_set&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;eval_set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rag_chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_answer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;actual&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;answer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sources_retrieved&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source_documents&lt;/span&gt;&lt;span class="sh"&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="n"&gt;results&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📌 &lt;strong&gt;Pro tip:&lt;/strong&gt; Pull the questions from real user queries where possible. If you have a Slack channel where employees ask the kind of questions the bot will answer, mine it for the first 30 questions. Real questions are always harder than invented ones.&lt;/p&gt;

&lt;p&gt;The eval set also tells you when you're done. "Good enough" stops being subjective — either it passes 90%+ of cases or it doesn't ship.&lt;/p&gt;

&lt;p&gt;Worth noting: in 2026, 60% of RAG deployments include systematic evaluation from day one, up from under 30% in early 2025. The teams that skipped it are the ones rebuilding their systems now.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠 Rule 2: One Source of Truth
&lt;/h2&gt;

&lt;p&gt;Most RAG failures I've traced start here — not in the model.&lt;/p&gt;

&lt;p&gt;The knowledge is scattered. Confluence has the official policy. Someone updated it in a Google Doc but didn't update Confluence. There's a Slack thread where a manager made a call that contradicts both. The RAG system indexes all three.&lt;/p&gt;

&lt;p&gt;The model retrieves two conflicting chunks. It can't tell which is authoritative. It synthesizes a confident-sounding answer that blends both — and matches neither.&lt;/p&gt;

&lt;p&gt;No retriever in the world solves this. It's a data problem, not a model problem.&lt;/p&gt;

&lt;p&gt;Step 1 of every RAG project I touch is not building the bot. It's forcing a canonical source:&lt;/p&gt;

&lt;p&gt;→ Pick one system as ground truth per knowledge domain (Confluence for policy, Notion for specs, etc.)&lt;br&gt;
→ Archive or redirect any conflicting copies — if it's not in the canonical source, it doesn't exist for the bot&lt;br&gt;
→ Set an update SLA: if a policy changes, the canonical page gets updated within 24 hours&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph TD
    A[User Query] --&amp;gt; B[Retriever]
    B --&amp;gt; C{Single canonical source?}
    C --&amp;gt;|Yes| D[Clean, consistent chunks]
    C --&amp;gt;|No| E[Conflicting chunks from 3 systems]
    D --&amp;gt; F[Faithful, accurate answer]
    E --&amp;gt; G[Confident hallucination]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sounds like busywork. It's actually the most important infrastructure decision in the project.&lt;/p&gt;

&lt;p&gt;Research backs it up: 60% of enterprise RAG projects fail not because of poor retrieval, but because they can't maintain data freshness at scale. One study found that when given unvetted baseline data, models fabricated responses for 52% of out-of-scope questions — not because the model was bad, but because it had no way to know what it didn't know.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 Rule 3: Fallback Over Hallucination
&lt;/h2&gt;

&lt;p&gt;A system that says "I don't know" is more valuable than one that guesses wrong.&lt;/p&gt;

&lt;p&gt;This sounds obvious. It's almost never implemented.&lt;/p&gt;

&lt;p&gt;The failure mode: the retriever pulls chunks that are loosely related but not actually relevant. The model generates a plausible-sounding answer from them. The user reads it. They have no way to know it's wrong. They act on it.&lt;/p&gt;

&lt;p&gt;Trust is built one answer at a time. It's destroyed the same way.&lt;/p&gt;

&lt;p&gt;Here's the pattern I use — a confidence-based router that sends uncertain answers to a human instead of letting the model guess:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# confidence_router.py
&lt;/span&gt;
&lt;span class="n"&gt;CONFIDENCE_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.75&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;route_with_fallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rag_chain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;retriever&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;docs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;retriever&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_relevant_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# No docs or low retrieval confidence → route to human
&lt;/span&gt;    &lt;span class="n"&gt;top_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;docs&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="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;top_score&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;CONFIDENCE_THRESHOLD&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;answer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;I&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;m not confident I have accurate information on this. &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Let me tag someone who can help — @support-team&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;routed_to_human&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;query&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rag_chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;answer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;answer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;routed_to_human&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sources&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source_documents&lt;/span&gt;&lt;span class="sh"&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;Pro tip:&lt;/strong&gt; Log every query that gets routed to a human. These are your highest-value training questions. Add them to the eval set with the correct answer documented. Over time, the system learns its own blind spots.&lt;/p&gt;

&lt;p&gt;The fallback message matters too. "I don't know — here's who does" is not a failure. Users who get honest fallbacks trust the system more than users who get confidently wrong answers twice.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Rule 4: Observability from Day One
&lt;/h2&gt;

&lt;p&gt;The eval set is your pre-deployment safety net. Observability is your production safety net.&lt;/p&gt;

&lt;p&gt;Log every conversation. Not just the query and the answer — log the retrieved chunks, the retrieval scores, the prompt constructed, and the final response.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# logger.py — minimal production RAG logging
&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_rag_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;retrieved_docs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;routed_to_human&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{}):&lt;/span&gt;
    &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;timestamp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;utcnow&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;query&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;retrieved_chunks&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;page_content&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&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;for&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;retrieved_docs&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;response&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;routed_to_human&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;routed_to_human&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;# Write to your logging backend — CloudWatch, Datadog, a flat file
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then build the review loop:&lt;/p&gt;

&lt;p&gt;→ Flag every answer that gets a thumbs-down or triggers a human escalation&lt;br&gt;
→ Review flagged answers weekly (30 minutes, not hours)&lt;br&gt;
→ Add wrong answers to the eval set with the correct answer documented&lt;br&gt;
→ Re-run evals before the next deployment&lt;/p&gt;

&lt;p&gt;This loop is what makes the system improve over time instead of silently degrade.&lt;/p&gt;

&lt;p&gt;The eval set starts at 30–40 questions. Six months in, it's 150 questions covering every edge case real users found. The system that was 80% accurate in week 1 is genuinely 95% accurate by month 6 — not because the model changed, but because the system around it got tighter.&lt;/p&gt;

&lt;p&gt;Tools I've used for this: LangSmith for tracing and full conversation logging, RAGAS for automated eval scoring, and a simple shared spreadsheet for the human review loop. You don't need an elaborate stack. You need the habit.&lt;/p&gt;




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

&lt;p&gt;✅ Write 30–40 eval questions before a single prompt — this is the line between a demo and a system you can maintain&lt;br&gt;
✅ Fix the data before building the bot — no retriever fixes conflicting or fragmented knowledge sources&lt;br&gt;
✅ A system that says "I don't know" is more valuable than one that confidently hallucinates&lt;/p&gt;




&lt;p&gt;The pattern I keep seeing: teams spend time optimizing the part that's already good (the model) and skip the parts that actually break in production (evals, data quality, fallbacks, observability). The boring infrastructure is what makes the intelligent part work.&lt;/p&gt;

&lt;p&gt;If you're building or inheriting a RAG system that performs well in testing but keeps surfacing wrong answers in production — these four things are almost always where it breaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  👋 Let's Connect
&lt;/h2&gt;

&lt;p&gt;If you found this useful or want to talk through a similar problem:&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://www.linkedin.com/in/akshay-kumar-bm" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; | 💻 &lt;a href="https://akshay-kumar-bm.github.io/" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt; | 📧 &lt;a href="mailto:akshaykumarbedre.bm@gmail.com"&gt;akshaykumarbedre.bm@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
      <category>rag</category>
    </item>
    <item>
      <title>I Built Graphode — An AI-Powered GitHub Repository Visualizer</title>
      <dc:creator>Harsh Kalia</dc:creator>
      <pubDate>Sun, 10 May 2026 10:39:56 +0000</pubDate>
      <link>https://popcorn.forem.com/harshkalia/i-built-graphode-an-ai-powered-github-repository-visualizer-3bpm</link>
      <guid>https://popcorn.forem.com/harshkalia/i-built-graphode-an-ai-powered-github-repository-visualizer-3bpm</guid>
      <description>&lt;h1&gt;
  
  
  I Built Graphode — An AI-Powered GitHub Repository Visualizer
&lt;/h1&gt;

&lt;p&gt;Ever spent hours trying to understand a new codebase? I did too. So I built Graphode to solve that problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Graphode?
&lt;/h2&gt;

&lt;p&gt;An AI-powered GitHub repository visualizer that helps you understand any codebase in minutes, not hours.&lt;/p&gt;

&lt;p&gt;Just upload a GitHub repo → Get instant insights on architecture, dependencies &amp;amp; code flow → Understand what you're looking at.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watch it in action:
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/RMtDsTH4bxQ"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

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

&lt;p&gt;✓ &lt;strong&gt;AI-Powered Analysis&lt;/strong&gt; — Uses Google Gemini AI to analyze your code&lt;br&gt;
✓ &lt;strong&gt;Visual Architecture&lt;/strong&gt; — See dependencies &amp;amp; code flow instantly&lt;br&gt;
✓ &lt;strong&gt;Real-Time Collaboration&lt;/strong&gt; — Analyze together with your team&lt;br&gt;
✓ &lt;strong&gt;Instant Insights&lt;/strong&gt; — No more hours wasted on code exploration&lt;/p&gt;

&lt;h2&gt;
  
  
  Perfect For
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Code reviews&lt;/li&gt;
&lt;li&gt;Onboarding new team members&lt;/li&gt;
&lt;li&gt;Diving into unfamiliar projects&lt;/li&gt;
&lt;li&gt;Understanding legacy codebases&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it free
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://graphode.tech/" rel="noopener noreferrer"&gt;https://graphode.tech/&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Would love your feedback! Let me know what you think in the comments 🙌&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>ai</category>
      <category>startup</category>
    </item>
    <item>
      <title>Building Echovault During a 130,000 Person Hackathon</title>
      <dc:creator>Ugo Nwune</dc:creator>
      <pubDate>Sun, 10 May 2026 10:37:09 +0000</pubDate>
      <link>https://popcorn.forem.com/bigbadbillion/building-echovault-during-a-130000-person-hackathon-40dc</link>
      <guid>https://popcorn.forem.com/bigbadbillion/building-echovault-during-a-130000-person-hackathon-40dc</guid>
      <description>&lt;p&gt;A few months ago I entered the world’s largest hackathon with over 130,000 competitors.&lt;/p&gt;

&lt;p&gt;My original project idea had nothing to do with AI memory preservation.&lt;/p&gt;

&lt;p&gt;I started by building a social commerce platform called OAK where people could upload clothing designs and have them printed onto real garments and shipped. Halfway through the competition I realized I wasn’t emotionally connected to the idea, and honestly it didn’t feel differentiated enough to compete at that scale.&lt;/p&gt;

&lt;p&gt;One of the hackathon sponsors was Tavus.&lt;/p&gt;

&lt;p&gt;Around that time I remembered a voice note my uncle sent me before he was killed in Nigeria.&lt;/p&gt;

&lt;p&gt;For years I replayed that recording during difficult periods of my life. Hearing his voice still carried emotional weight long after he was gone. But eventually I kept thinking about something unsettling:&lt;/p&gt;

&lt;p&gt;the voice note was static.&lt;/p&gt;

&lt;p&gt;I could replay it forever, but I could never ask a new question.&lt;br&gt;
I could never hear a new story.&lt;br&gt;
The memory was frozen in time.&lt;/p&gt;

&lt;p&gt;That realization became the foundation for Echovault.&lt;/p&gt;

&lt;p&gt;I pivoted completely and spent the next 9 days building an AI digital legacy platform designed to preserve a person’s memories, personality, stories, and voice for future generations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;p&gt;The project started on Bolt.new since the hackathon required it, then eventually moved into Cursor for faster iteration.&lt;/p&gt;

&lt;p&gt;The stack ended up looking like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React frontend&lt;/li&gt;
&lt;li&gt;Supabase backend&lt;/li&gt;
&lt;li&gt;Gemini for NLP and embeddings&lt;/li&gt;
&lt;li&gt;Tavus for conversational video&lt;/li&gt;
&lt;li&gt;ElevenLabs for voice synthesis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mostly written in typescript and deployed on vercel. The core idea behind Echovault was building an “Echo,” an AI representation of a person trained on their memories, personality traits, and life experiences through guided conversations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Disaster Moment
&lt;/h2&gt;

&lt;p&gt;At one point during development, an AI assistant accidentally triggered a database reset during a prompt chain.&lt;/p&gt;

&lt;p&gt;I blindly approved it.&lt;/p&gt;

&lt;p&gt;The entire database disappeared instantly.&lt;/p&gt;

&lt;p&gt;That mistake cost nearly two full days of recovery work. I had to rebuild from an old schema.sql file inside the workspace, recreate missing tables manually, and rewrite parts of the RLS policies to secure the database properly again.&lt;/p&gt;

&lt;p&gt;The recovered database was never quite the same afterward, but the project survived.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;Echovault ended up winning the “Most Inspirational Story” award at the hackathon.&lt;/p&gt;

&lt;p&gt;Part of me secretly hoped to win something more technical because I was proud of how ambitious the architecture became under such a short timeline, but the award still meant a lot because the story behind the product was deeply personal.&lt;/p&gt;

&lt;p&gt;The experience completely changed how I think about software creation.&lt;/p&gt;

&lt;p&gt;Long term, my goal is to make Echovault a legitimate way for people to digitally preserve themselves for the far future.&lt;/p&gt;

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

</description>
      <category>ai</category>
      <category>digitallegacy</category>
      <category>echovault</category>
      <category>react</category>
    </item>
    <item>
      <title>Why We Render Everything in the Browser</title>
      <dc:creator>Vivian Voss</dc:creator>
      <pubDate>Sun, 10 May 2026 10:35:52 +0000</pubDate>
      <link>https://popcorn.forem.com/vivian-voss/why-we-render-everything-in-the-browser-bak</link>
      <guid>https://popcorn.forem.com/vivian-voss/why-we-render-everything-in-the-browser-bak</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxc46id2zs8sj1y3npm2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxc46id2zs8sj1y3npm2.png" alt="Editorial illustration in hand-drawn ink style. On the left, a quote in serif type: " width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;On Second Thought — Episode 07&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Open any modern site. The utility provider's login, the restaurant booking, the parcel tracker. The laptop fan spins up to render text. The median page in 2025 ships 697 KB of JavaScript before a single character of content is visible. The browser, meanwhile, is asked to do the work that a server in 1996 already did, and to do it on a battery, on a metered connection, on a chassis warm enough to taste.&lt;/p&gt;

&lt;p&gt;This is the post about that.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Axiom
&lt;/h2&gt;

&lt;p&gt;The reflex is universal. Every new web project begins with a frontend framework, a build pipeline, a bundler, a hydration strategy. The server, where the data already lives, has been reduced to a JSON tap. Rendering is the browser's problem now. Nobody quite remembers when this was decided.&lt;/p&gt;

&lt;p&gt;It was not decided in any single meeting, or with any single argument. It compounded. Each project chose the framework because the previous project had; each developer learned the framework because that was the job posting. By the time anyone thought to question the assumption, the assumption had become the architecture, the curriculum, the conference circuit, the hiring funnel. Reaching for a server-rendered page in 2026 feels, to many engineers, like reaching for COBOL: technically defensible, professionally suspect.&lt;/p&gt;

&lt;p&gt;That feeling is the topic.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Origin
&lt;/h2&gt;

&lt;p&gt;AJAX, 2005. Jesse James Garrett gave the pattern its name in his now-famous essay, describing how Gmail and Google Maps used asynchronous XMLHttpRequest to update parts of a page without a full reload. The technique was real, the gain was real, the use cases were narrow: applications in which a user lived for hours and interacted hundreds of times per session.&lt;/p&gt;

&lt;p&gt;Backbone arrived in 2010 (Jeremy Ashkenas), Angular the same year (Misko Hevery, Adam Abrons), Ember in 2011, React in 2013 (Jordan Walke at Facebook). Each was a sincere response to a real problem: the desktop-application-in-a-browser, an experience that genuinely required client-side state management, view diffing, and offline tolerance. Gmail, Google Maps, Figma. Real applications, real argument.&lt;/p&gt;

&lt;p&gt;The pattern then spread to every site that was not Gmail. Marketing pages, brochure sites, restaurant menus, government forms, regional rail booking, doctor's-surgery appointments. The argument that justified Gmail's architecture was never re-examined for the brochure, because re-examining the argument required a different skill set than building the brochure had required. By 2018, the SPA was treated as the default architecture of the web. By 2020, "I'll just spin up a Next.js project" was the unexamined first move for static content.&lt;/p&gt;

&lt;p&gt;The shift was not theoretical; it was a hiring problem. A generation of frontend developers learned React in a bootcamp, then a job, then another job, and never learned a server language. The job market rewarded React on the CV; nobody was hiring for "knows what a session cookie is". TypeScript arrived as the local repair: a build-time wrapper meant to compensate for the deficiencies of the language the team had chosen because it was the only one anyone knew. The fix was added before the question was asked.&lt;/p&gt;

&lt;p&gt;Episode 02 of this series left this question open: what happens when a profession trains on tools instead of foundations? This is its first practical consequence. The architecture follows the curriculum. The web becomes a thing that requires a 700 KB bundle to display a heading because the people who build it cannot, professionally, build it any other way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Cost
&lt;/h2&gt;

&lt;p&gt;Median page weight in 2025, per the HTTP Archive Web Almanac: 697 KB of JavaScript on home pages, 632 KB on inner pages. The 90th percentile: 1,979 KB on home pages. The 10th percentile: 87 KB. The lower bound is, demonstrably, achievable. Most teams are nowhere near it.&lt;/p&gt;

&lt;p&gt;The first cost is paid downstream, on the device, in electricity. On a mid-range Android over 4G, those numbers translate into eight seconds to Time to Interactive on a representative page, and more on a slow connection. Mobile data, in EU roaming, is not free. The cost that is harder to name on an invoice is the wattage. Each page load now drives the client CPU and GPU as if it were running a workload, not displaying text. Frameworks parse, hydrate, diff, reconcile, and re-render; the silicon spins; the fan, on a quiet office, becomes audible. Battery sensors register the drain in measurable single-digit percentages per twenty minutes of casual reading. The user is, in literal terms, paying for the rendering with their own battery and their own data plan, on hardware they bought, for content the server already had. There is no return on the spending, because the page was a printed leaflet at heart.&lt;/p&gt;

&lt;p&gt;Multiplied across a billion daily web sessions, the unnecessary draw climbs into terawatt-hours per year, a figure documented in the Sustainable Web Manifesto's reference dataset and the W3C Web Sustainability Guidelines. The electricity is only the easiest column to count. Beneath it sits the hardware that consumed it: the lithium for the laptop battery that drains faster, the rare earths in the radio that keeps the data flowing, the cobalt in the datacentre's storage, the copper in the racks, the cooling water that the racks then warm. Megatons of natural resources, quietly enlisted on the side of a marketing page that did not need any of them. There is, here, an inconvenient observation. The same conferences that run sustainability tracks ship frameworks of half a megabyte per visit; the same engineer who publishes a sustainability-conscious LinkedIn post will, on Monday morning, push a pull request that adds 200 KB of JavaScript to a marketing page. The contradiction holds itself politely apart, and is, on close inspection, untenable. One cannot ship the bundle and lecture on pollution in the same conversation.&lt;/p&gt;

&lt;p&gt;Accessibility collapses without JavaScript. Screen readers must wait for the framework to construct the DOM before they can announce anything; if the JavaScript fails to load, the page is empty. Crawlers must execute the JavaScript to index the content, which means search-engine indexing has become a secondary industry of headless browsers, and the cost of that industry is borne by datacentres no one sees on the invoice.&lt;/p&gt;

&lt;p&gt;The browser tab is now the heaviest process on the average laptop. Most of what it computes is layout for content that the server already had, in a format the server could already serve. The Senior Engineer's day, when she debugs why the search bar takes eight hundred milliseconds to respond, walks through a stack of seven layers between the user and the database, finds at the bottom a query that wants for an index, and notes that the layer above it could have been a single server-rendered HTML response. The HTML response would have been forty kilobytes. The current implementation is six hundred and ninety-seven.&lt;/p&gt;

&lt;p&gt;Then, having pacified the client, the same language was asked to manage the server. Node.js, originally an event-driven runtime for I/O-bound real-time workloads (which it does competently), was deployed in whole cohorts of new projects to do work that PHP, Ruby, Python and Go had been doing efficiently for decades. The reason was not technical. Node.js is not faster than Go (it is not), not smaller than Rust (it is not), not safer than Python (it is not). It was deployed because the team knew only the one language and could not, professionally, choose another. The build pipeline that wraps the language to compensate for its deficiencies on the client was duplicated on the server. Every architectural decision compounds. The bill is paid twice: once at the client, once at the rack. The rack pays in CPU cycles and in megawatt-hours; the client pays in milliseconds and in power. Neither user signed up for either.&lt;/p&gt;

&lt;p&gt;Around all of it, the dependency cloud, and a quietly inconvenient truth at the bottom of it. JavaScript was shipped, in 1995, without a standard library worthy of the name; npm appeared in 2010 to fill the vacuum, and the vacuum filled, in turn, with hundreds of transitive packages from strangers, then thousands. It is, by some distance, the public software repository most reliably compromised in routine use. The 2024 Sonatype State of the Software Supply Chain report counted more than half a million malicious packages across public registries; npm carried the bulk of them. left-pad in 2016, event-stream in 2018, ua-parser-js in 2021, and the September 2025 incident in which eighteen packages with 2.6 billion weekly downloads were compromised in a single coordinated attack, are the headlines a Senior Engineer can name. The thousand smaller incidents are the ones nobody tracks.&lt;/p&gt;

&lt;p&gt;The maintenance of the dependency cloud is then outsourced to a second cloud, the supervisory cloud: Dependabot, Snyk, Renovate, GitHub Advanced Security, the long tail of supply-chain-monitoring SaaS. Each one runs on servers, consumes electricity, opens pull requests for other servers to review, sends Slack notifications for engineers to triage, and produces dashboards for managers to look at. The supervisory cloud has, in turn, its own dependencies, its own build pipelines, its own pricing tiers. The wrappers wrap the wrappers. One does, at some point, lose count of the clouds.&lt;/p&gt;

&lt;p&gt;The question that closes this section is the obvious one, and the one that the industry has spent fifteen years pretending not to ask. If the answer to a security failure in your dependencies is to add another vendor, another runtime, another monitoring service, and another bill, you have not solved the problem. You have rented a louder version of it. None of this would exist in a language whose standard library could carry the weight of a real application. Rust, Go, Python, Ruby, even PHP all ship with first-party batteries that npm has spent a decade and a half badly approximating, with the supply chain to match. The vacuum was self-inflicted, in the choice of the language at the bottom of the stack.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Question
&lt;/h2&gt;

&lt;p&gt;The proofs are not theoretical. They are in production, and they have been for years.&lt;/p&gt;

&lt;p&gt;Wikipedia: 60 million articles, MediaWiki on PHP 8.3 with MySQL/MariaDB and an aggressive caching layer, server-rendered, faster on a budget Android over a coffee-shop wireless than most marketing single-page applications. The Wikimedia infrastructure handles hundreds of thousands of views per second, and it does so by caching server-rendered HTML, not by shipping a runtime to the client.&lt;/p&gt;

&lt;p&gt;GOV.UK: 67 million citizens, designed by the Government Digital Service from 2012 onward, with progressive enhancement mandated by the GOV.UK service manual for every government service. HTML first, CSS second, JavaScript only as enhancement. The principle is documented, the policy is enforced, the result is a public-sector portal that opens on a Nokia from 2007 and an iPhone from 2024 alike. It is not glamorous. It is, demonstrably, robust.&lt;/p&gt;

&lt;p&gt;Hacker News: server-rendered, written in Arc (a Common Lisp dialect) by Paul Graham and Robert Morris from 2007, opens before the loading spinner of any modern dashboard. The site is famously austere, deliberately so. It is also, after eighteen years, still online and still fast.&lt;/p&gt;

&lt;p&gt;HEY and Basecamp, the products of 37signals: server-rendered with Hotwire (a Ruby on Rails extension that DHH and his team published in 2020), fully interactive, no client-side framework. The interactive elements arrive over the wire as HTML fragments, swapped into place by a tiny client-side library. The model is older than the SPA, applied to a modern email client, and it works.&lt;/p&gt;

&lt;p&gt;HTMX, by Carson Gross at Big Sky Software (2020): 14 KB minified, around 5 KB gzipped, doing what JavaScript frameworks an order of magnitude larger claim to do. Carson Gross's argument is the simplest version of the case in this post: most of what we want a SPA for can be done with attributes on plain HTML, and the rest can wait.&lt;/p&gt;

&lt;p&gt;Netflix's logged-out homepage, 2017: the team removed client-side React entirely from the landing page and rebuilt the language switcher in fewer than 300 lines of vanilla JavaScript. Time to Interactive improved by more than 50%, and Jake Archibald's writeup of the change remains one of the canonical case studies for the cost of unnecessary client-side rendering. Netflix did not abandon React; it kept it server-side, where the value is, and removed it from the client, where the cost is.&lt;/p&gt;

&lt;p&gt;Cloudflare Pingora, 2022: Cloudflare published a blog post describing how their nginx-and-Lua proxy, after years of scaling, had hit the limits of its architecture, and was replaced with a Rust-based proxy of their own design. The new proxy serves over a trillion requests per day, with about 70% less CPU and 67% less memory than the old one. The lesson is not "Rust beats Lua" in any tribal sense; it is "a small, focused, efficient server kernel beats a tower of accreted layers, and the savings show up on the electricity bill the same week".&lt;/p&gt;

&lt;p&gt;A word on the standard objection, before it appears. The reflexive defence of the SPA is "but we need reactivity". Reactivity has not been an obstacle to server-rendered architectures for at least a decade. Hotwire's Turbo Streams, HTMX's &lt;code&gt;hx-swap&lt;/code&gt; and &lt;code&gt;hx-trigger&lt;/code&gt; attributes, Phoenix LiveView's WebSocket-driven HTML diffs, Laravel Livewire, ASP.NET Blazor Server: all of them deliver partial updates, optimistic UI, two-way binding, even real-time collaborative behaviour, by sending small HTML fragments over the wire instead of shipping a runtime to interpret JSON. The total client-side weight, in every one of these patterns, is in single-digit kilobytes. Reactivity is a solved problem. The framework industry sells it back as if it were not.&lt;/p&gt;

&lt;p&gt;Each of these stacks chose a different server language: PHP for MediaWiki, Ruby for Rails and Hotwire, Common Lisp for Hacker News, Python for Django sites in the same family, Go for many modern static-content tools, Rust for Pingora and the modern wave. On a FreeBSD server, any of these is a single &lt;code&gt;pkg install&lt;/code&gt; away, with one service manager and one configuration tree. The language is the smaller question; what matters is that the rendering happens on the server, where the data and the session already live, in a runtime that does not have to be re-shipped to every visitor.&lt;/p&gt;

&lt;p&gt;Rust is, for the modern build, particularly hard to argue against. The combination of a single static binary, no garbage collector, native concurrency, and the kind of compile-time safety that removes whole classes of runtime error is, today, the easiest case to make. But the case is not "use Rust". The case is "render where the data is".&lt;/p&gt;

&lt;p&gt;The larger question is this. What if rendering happened where the data already lived, and the data did not need to be guarded from a thousand strangers we never invited into the project? Most of the cost of the modern web, paid in milliseconds, in power, in megabytes, in accessibility, in indexability, in carbon, in security incidents, in supervisory SaaS, would simply not exist. The fastest bundle is the one that is never shipped. The safest dependency is the one that was never installed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://vivianvoss.net/blog/why-we-render-everything-in-the-browser" rel="noopener noreferrer"&gt;Read the full article on vivianvoss.net →&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;By &lt;a href="https://vivianvoss.net" rel="noopener noreferrer"&gt;Vivian Voss&lt;/a&gt; — System Architect &amp;amp; Software Developer. Follow me on &lt;a href="https://www.linkedin.com/in/vvoss/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for daily technical writing.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webperf</category>
      <category>frontend</category>
      <category>architecture</category>
      <category>serverside</category>
    </item>
    <item>
      <title>The Most Common Bug in Liters to Gallons Converters</title>
      <dc:creator>md nurul islam</dc:creator>
      <pubDate>Sun, 10 May 2026 10:31:45 +0000</pubDate>
      <link>https://popcorn.forem.com/md_nurulislam_eed3d12f6c/the-most-common-bug-in-liters-to-gallons-converters-5em8</link>
      <guid>https://popcorn.forem.com/md_nurulislam_eed3d12f6c/the-most-common-bug-in-liters-to-gallons-converters-5em8</guid>
      <description>&lt;p&gt;A liters-to-gallons converter looks easy.&lt;/p&gt;

&lt;p&gt;You take a liter value, multiply it by a conversion factor, and show the answer.&lt;/p&gt;

&lt;p&gt;For US liquid gallons, the formula is:&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;gallons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;liters&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.264172052358&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple.&lt;/p&gt;

&lt;p&gt;But there is one common mistake that can make the entire converter wrong:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;not specifying which gallon you mean.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A US liquid gallon and an imperial gallon are not the same.&lt;/p&gt;

&lt;p&gt;That means a converter can have clean code, good formatting, and a nice UI, but still give the wrong answer if it uses the wrong gallon standard.&lt;/p&gt;

&lt;p&gt;I worked through this while building a browser-based &lt;a href="https://utilityera.com/conversion/volume/liters-to-gallons/" rel="noopener noreferrer"&gt;liters to gallons converter&lt;/a&gt;. The biggest lesson was simple: the formula is not enough. The unit definition matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Be clear: US gallons or imperial gallons?
&lt;/h2&gt;

&lt;p&gt;This is the first decision.&lt;/p&gt;

&lt;p&gt;For US liquid gallons:&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;US_GALLONS_PER_LITER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.264172052358&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the function becomes:&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;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;liters&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;liters&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;US_GALLONS_PER_LITER&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;For imperial gallons, the factor is different:&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;IMPERIAL_GALLONS_PER_LITER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.2199692483&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So this would be:&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;litersToImperialGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;liters&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;liters&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;IMPERIAL_GALLONS_PER_LITER&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 difference matters.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="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;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// 2.64172052358&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;litersToImperialGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// 2.199692483&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same 10 liters.&lt;/p&gt;

&lt;p&gt;Different answer.&lt;/p&gt;

&lt;p&gt;That is why your UI should not just say:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;It should say:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;US gallons
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Imperial gallons
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Users should never have to guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use readable constants
&lt;/h2&gt;

&lt;p&gt;This is not great:&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;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.264172052358&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;It works, but the number has no context.&lt;/p&gt;

&lt;p&gt;This is better:&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;US_GALLONS_PER_LITER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.264172052358&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;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;liters&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;liters&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;US_GALLONS_PER_LITER&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;Now the code explains itself.&lt;/p&gt;

&lt;p&gt;Anyone reading it can see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the input is liters&lt;/li&gt;
&lt;li&gt;the output is US gallons&lt;/li&gt;
&lt;li&gt;the factor is gallons per liter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Readable code matters more than saving one line.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Format the result before showing it
&lt;/h2&gt;

&lt;p&gt;Raw decimal output can feel messy.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;gallons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;litersToUSGallons&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="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;gallons&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// 0.792516157074&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is technically fine, but it may be too much for most users.&lt;/p&gt;

&lt;p&gt;A normal user probably expects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3 L = 0.792516 gal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So format the number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;maxDecimals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&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="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NumberFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en-US&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="na"&gt;maximumFractionDigits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;maxDecimals&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;Then:&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;gallons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;litersToUSGallons&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="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;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gallons&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// 0.792516&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cleaner. Easier to scan. Still accurate enough for normal use.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Use smart precision
&lt;/h2&gt;

&lt;p&gt;Not every value needs the same number of decimal places.&lt;/p&gt;

&lt;p&gt;Small values need more precision:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0.1 L = 0.026417 gal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Large values can be shorter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;100 L = 26.42 gal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple formatter can handle 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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;formatGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&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="nf"&gt;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&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="nf"&gt;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps the output useful instead of noisy.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="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;formatGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;span class="c1"&gt;// 0.132086&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;formatGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;litersToUSGallons&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="c1"&gt;// 1.3209&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;formatGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;span class="c1"&gt;// 132.09&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good formatting is part of the user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Handle empty and invalid input
&lt;/h2&gt;

&lt;p&gt;Users do not always type perfect values.&lt;/p&gt;

&lt;p&gt;They may:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;clear the field&lt;/li&gt;
&lt;li&gt;paste spaces&lt;/li&gt;
&lt;li&gt;enter text&lt;/li&gt;
&lt;li&gt;type a negative number&lt;/li&gt;
&lt;li&gt;use decimals&lt;/li&gt;
&lt;li&gt;enter a very large number&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your converter should not show &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Start with a safe parser:&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;parseInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="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="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&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="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use it before converting:&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;convertInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;liters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;liters&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;gallons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;liters&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;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nf"&gt;formatGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gallons&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt; US gal`&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;This keeps the UI clean.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Decide whether negative values are allowed
&lt;/h2&gt;

&lt;p&gt;Mathematically, negative liters can be converted:&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="nf"&gt;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&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="c1"&gt;// -1.32086026179&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But does that make sense in your product?&lt;/p&gt;

&lt;p&gt;For a general math tool, maybe yes.&lt;/p&gt;

&lt;p&gt;For fuel, water, cooking, aquarium volume, beverage containers, or household measurement, negative volume usually does not make sense.&lt;/p&gt;

&lt;p&gt;If your tool should block negative values, make that rule explicit:&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;parseVolumeInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;number&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="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="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not a math decision.&lt;/p&gt;

&lt;p&gt;It is a product decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Build the converter client-side
&lt;/h2&gt;

&lt;p&gt;For simple unit conversions, an API is usually unnecessary.&lt;/p&gt;

&lt;p&gt;The browser can calculate this instantly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10 liters × 0.264172052358
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no need to send that value to a server.&lt;/p&gt;

&lt;p&gt;Client-side conversion gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;faster response&lt;/li&gt;
&lt;li&gt;no network dependency&lt;/li&gt;
&lt;li&gt;lower server cost&lt;/li&gt;
&lt;li&gt;better privacy&lt;/li&gt;
&lt;li&gt;fewer failure points&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For simple calculators, the best backend is often no backend.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Minimal working example
&lt;/h2&gt;

&lt;p&gt;Here is a basic liters-to-US-gallons converter using plain HTML and JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"liters"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Liters&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt;
  &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"liters"&lt;/span&gt;
  &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt;
  &lt;span class="na"&gt;inputmode=&lt;/span&gt;&lt;span class="s"&gt;"decimal"&lt;/span&gt;
  &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter liters"&lt;/span&gt;
&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
  Result:
  &lt;span class="nt"&gt;&amp;lt;output&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"result"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;0 US gal&lt;span class="nt"&gt;&amp;lt;/output&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;US_GALLONS_PER_LITER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.264172052358&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;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;liters&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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;result&lt;/span&gt;&lt;span class="dl"&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;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;liters&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;liters&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;US_GALLONS_PER_LITER&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;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;maxDecimals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&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="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NumberFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en-US&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="na"&gt;maximumFractionDigits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;maxDecimals&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;formatGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&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="nf"&gt;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&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="nf"&gt;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;formatNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;parseInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="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="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&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="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&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;input&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;input&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;liters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&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;liters&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0 US gal&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;gallons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;liters&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nf"&gt;formatGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gallons&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt; US gal`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is small, but it handles the important parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;correct US gallon formula&lt;/li&gt;
&lt;li&gt;readable output&lt;/li&gt;
&lt;li&gt;empty input handling&lt;/li&gt;
&lt;li&gt;mobile-friendly number input&lt;/li&gt;
&lt;li&gt;no API request&lt;/li&gt;
&lt;li&gt;clear unit label&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  9. Test the boring cases
&lt;/h2&gt;

&lt;p&gt;Most converter bugs happen in boring places.&lt;/p&gt;

&lt;p&gt;Test these first:&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="nf"&gt;litersToUSGallons&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;// 0&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;litersToUSGallons&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="c1"&gt;// 0.264172052358&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;litersToUSGallons&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;// 0.528344104716&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;litersToUSGallons&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// 2.64172052358&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;litersToUSGallons&lt;/span&gt;&lt;span class="p"&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;// 26.4172052358&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also test the UI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;empty input
spaces only
decimal values
very small values
very large values
negative values
mobile keyboard input
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A converter that only works for perfect input is not finished.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Add useful examples
&lt;/h2&gt;

&lt;p&gt;A good converter should not only calculate.&lt;/p&gt;

&lt;p&gt;It should also help users understand common values quickly.&lt;/p&gt;

&lt;p&gt;Examples are useful:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 L = 0.264172 US gal
2 L = 0.528344 US gal
5 L = 1.320860 US gal
10 L = 2.641721 US gal
20 L = 5.283441 US gal
100 L = 26.417205 US gal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These examples make the tool easier to trust.&lt;/p&gt;

&lt;p&gt;They also help users check whether the result looks reasonable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final checklist
&lt;/h2&gt;

&lt;p&gt;Before publishing a liters-to-gallons converter, check these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are you using US gallons or imperial gallons?&lt;/li&gt;
&lt;li&gt;Does the UI clearly say which gallon type is used?&lt;/li&gt;
&lt;li&gt;Is the conversion factor correct?&lt;/li&gt;
&lt;li&gt;Is the result formatted clearly?&lt;/li&gt;
&lt;li&gt;Does the input handle empty values?&lt;/li&gt;
&lt;li&gt;Does the UI avoid showing &lt;code&gt;NaN&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;Does it work well on mobile?&lt;/li&gt;
&lt;li&gt;Are common examples included?&lt;/li&gt;
&lt;li&gt;Is an API really necessary?&lt;/li&gt;
&lt;li&gt;Is the output accessible?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The formula is easy.&lt;/p&gt;

&lt;p&gt;The real mistake is assuming “gallon” means the same thing everywhere.&lt;/p&gt;

&lt;p&gt;That one detail can make the whole converter wrong.&lt;/p&gt;

&lt;p&gt;You can test a live US-gallon version here: &lt;a href="https://utilityera.com/conversion/volume/liters-to-gallons/" rel="noopener noreferrer"&gt;liters to gallons converter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Claude Code: The Complete Setup Guide for macOS, Windows, and Linux</title>
      <dc:creator>Dev Daily</dc:creator>
      <pubDate>Sun, 10 May 2026 10:28:18 +0000</pubDate>
      <link>https://popcorn.forem.com/devdaily_2026/claude-code-the-complete-setup-guide-for-macos-windows-and-linux-3dbl</link>
      <guid>https://popcorn.forem.com/devdaily_2026/claude-code-the-complete-setup-guide-for-macos-windows-and-linux-3dbl</guid>
      <description>&lt;p&gt;Claude Code is Anthropic's official command-line agent for software engineering. It lives in your terminal, reads your repository, runs commands on your behalf, and edits files with a level of context awareness that no autocomplete can match. This guide walks you through installing it on macOS, Windows, and Linux, signing in, configuring your first project, and getting to a productive flow before lunch.&lt;/p&gt;

&lt;p&gt;We'll skip the marketing and focus on the parts that actually matter — the install steps that fail silently if you skip them, the settings worth tweaking on day one, and the workflow patterns that make Claude Code feel like a senior engineer pairing with you instead of a fancier autocomplete.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you'll learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Installing Claude Code via the official installer or npm&lt;/li&gt;
&lt;li&gt;Signing in with an Anthropic account or API key&lt;/li&gt;
&lt;li&gt;Trusting your first project and running your first prompt&lt;/li&gt;
&lt;li&gt;Configuring permissions, hooks, and MCP servers&lt;/li&gt;
&lt;li&gt;A workflow checklist for daily use&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You need a working terminal, Node.js 18 or newer if you choose the npm install path, and an Anthropic account. A paid Claude.ai subscription gets you generous usage; otherwise an API key works the same way and bills per token.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;macOS:&lt;/strong&gt; any modern Mac (Apple Silicon or Intel) with Terminal or iTerm2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows:&lt;/strong&gt; Windows 10 or 11 with WSL2 strongly recommended for the Linux-flavored tooling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux:&lt;/strong&gt; any major distro with a recent shell.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install on macOS
&lt;/h2&gt;

&lt;p&gt;The fastest path on macOS is the official one-liner. It downloads the binary, places it in &lt;code&gt;~/.local/bin&lt;/code&gt;, and adds the directory to your shell &lt;code&gt;PATH&lt;/code&gt; if it isn't already there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Official installer (recommended)&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://claude.ai/install.sh | sh

&lt;span class="c"&gt;# Verify&lt;/span&gt;
claude &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you prefer to keep all your CLIs managed by a package manager, you can use Homebrew or npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Homebrew (community formula)&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;anthropic/claude/claude

&lt;span class="c"&gt;# Or via npm (works on every OS)&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @anthropic-ai/claude-code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install on Windows
&lt;/h2&gt;

&lt;p&gt;On Windows you have two reasonable options: native PowerShell or WSL2. Most teams pick WSL2 because the rest of the developer experience — Docker, Git, Node — works more smoothly there. Inside WSL2, follow the Linux steps below. For native Windows, install Node 18+ and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# In an Admin PowerShell&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-g&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="nx"&gt;anthropic-ai/claude-code&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;claude&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--version&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If &lt;code&gt;claude&lt;/code&gt; isn't found after install, restart your shell so the new &lt;code&gt;PATH&lt;/code&gt; entry takes effect.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Install on Linux
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Recommended&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://claude.ai/install.sh | sh

&lt;span class="c"&gt;# Or with npm&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @anthropic-ai/claude-code

&lt;span class="c"&gt;# Confirm&lt;/span&gt;
claude &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Sign in for the first time
&lt;/h2&gt;

&lt;p&gt;Run &lt;code&gt;claude&lt;/code&gt; inside any terminal and follow the browser prompt. You'll authenticate against Anthropic, your local CLI will receive a session token, and subsequent runs won't need to log in again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude
&lt;span class="c"&gt;# → opens a browser tab → sign in → return to the terminal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prefer using a raw API key (e.g., for headless servers or CI)? Export it before launching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;sk-ant-...
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Trust your first project
&lt;/h2&gt;

&lt;p&gt;Open a real repository — not your home folder — and start &lt;code&gt;claude&lt;/code&gt; from inside it. The first time, Claude Code asks for permission to read and edit files in that directory. Approve it for the project root and you're ready to prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/code/my-project
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try a small, observable task first. Ask Claude to summarize the project, identify the entry points, or fix a tiny bug. The point is to see Claude read files, run commands, and propose edits before you trust it with larger work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure on day one
&lt;/h2&gt;

&lt;p&gt;Three settings pay for themselves immediately:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Permissions:&lt;/strong&gt; in &lt;code&gt;~/.claude/settings.json&lt;/code&gt;, allow safe shell tools by default and require confirmation for destructive ones (anything that touches Git history, deletes files, or pushes to remotes).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hooks:&lt;/strong&gt; add a hook that runs your formatter and tests after every edit. The model gets immediate feedback when it breaks something.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP servers:&lt;/strong&gt; wire up a database MCP server so Claude can read your schema, and a docs MCP server for your framework of choice.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  A first-day workflow
&lt;/h2&gt;

&lt;p&gt;Once installed, the actual productivity move is treating Claude Code like a junior engineer who happens to be very fast. Brief it like a colleague: explain the goal, point at the right files, share constraints, and review its diffs the way you'd review a teammate's pull request. Don't dump bare instructions and expect magic — context is what makes this work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start each session by orienting Claude: "Here is what we're working on, here is the relevant file, here is what success looks like."&lt;/li&gt;
&lt;li&gt;Have it write tests &lt;em&gt;before&lt;/em&gt; the implementation when you can — it forces the spec into the open.&lt;/li&gt;
&lt;li&gt;Run a tight feedback loop: edit, test, commit. Don't let it stack ten changes without verification.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Most install failures fall into three buckets — corporate proxies blocking the install script, stale shell cache hiding the new &lt;code&gt;PATH&lt;/code&gt;, or Node version mismatches when using the npm install path. Restart the shell, check &lt;code&gt;which claude&lt;/code&gt;, and try the official installer if npm misbehaves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;Once you're set up, learn three concepts: &lt;strong&gt;slash commands&lt;/strong&gt; for repeatable workflows, &lt;strong&gt;hooks&lt;/strong&gt; for automatic verification after edits, and &lt;strong&gt;MCP servers&lt;/strong&gt; for giving Claude access to data sources beyond the file system. We cover each in dedicated tutorials on the blog.&lt;/p&gt;




&lt;p&gt;Originally published on &lt;a href="https://devdaily.in/blog/claude-code-complete-setup-guide-macos-windows-linux" rel="noopener noreferrer"&gt;DevDaily&lt;/a&gt; — practical engineering tutorials, daily.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>claudecode</category>
      <category>anthropic</category>
      <category>cli</category>
    </item>
    <item>
      <title>We list 3 self-host PagerDuty alternatives. None of them are alive. (May 2026)</title>
      <dc:creator>os-alt</dc:creator>
      <pubDate>Sun, 10 May 2026 10:24:24 +0000</pubDate>
      <link>https://popcorn.forem.com/osalt/we-list-3-self-host-pagerduty-alternatives-none-of-them-are-alive-may-2026-1a71</link>
      <guid>https://popcorn.forem.com/osalt/we-list-3-self-host-pagerduty-alternatives-none-of-them-are-alive-may-2026-1a71</guid>
      <description>&lt;p&gt;The on-call OSS space has a problem. Of the three self-hostable PagerDuty alternatives our directory recommends, &lt;strong&gt;zero are currently alive&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code-rho-dun.vercel.app/blog/most-self-host-alternatives-are-still-alive-but-some-arent-2026-05/" rel="noopener noreferrer"&gt;Last week's first repo-health snapshot&lt;/a&gt; flagged ~11% of all listed self-host alternatives as not-alive. This week we're zooming in on the worst-affected single category: on-call rotation and incident paging. It's not 11%. It's 100%.&lt;/p&gt;

&lt;p&gt;If you're paying $21–41/user/month for PagerDuty and were planning the self-host escape hatch, the directories you're staring at — including ours — are largely out of date. Here's what May 2026 actually looks like, and what to do instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three we listed (and what their health pill says today)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Repo&lt;/th&gt;
&lt;th&gt;Stars&lt;/th&gt;
&lt;th&gt;Last commit&lt;/th&gt;
&lt;th&gt;Archived&lt;/th&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;grafana/oncall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;3,881&lt;/td&gt;
&lt;td&gt;2026-03-24&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;dead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;linkedin/oncall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1,249&lt;/td&gt;
&lt;td&gt;2025-08-20&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;stale&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cabotapp/cabot&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;404 from GitHub API&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three projects, three different ways of being not-alive. Worth taking each one in turn — the failure modes generalize to any OSS-buying decision in 2026.&lt;/p&gt;

&lt;h3&gt;
  
  
  Grafana OnCall — archived two months ago
&lt;/h3&gt;

&lt;p&gt;The most painful entry. Grafana archived their own on-call project on 2026-03-24. The repo's README points at "Grafana IRM" — Grafana's roadmap-rebranded successor. As of May 2026, IRM is a paid Grafana Cloud feature, not a self-host package.&lt;/p&gt;

&lt;p&gt;For a self-hoster, that means: the codebase is frozen, no PRs accepted, the next features live behind a SaaS paywall. What makes this trap harder to spot is that the repo still has &lt;em&gt;recent&lt;/em&gt; commits — the archive happened after a scramble of farewell fixes. A tool that surfaces only &lt;code&gt;last_commit_at&lt;/code&gt; would tell you OnCall is fine. The signal that catches it is &lt;code&gt;archived: true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Lesson: when you're picking a self-host target, last-commit-recency is half the answer. The other half is the archive flag, and roughly a third of the "dead" repos in our snapshot are dead specifically because of &lt;code&gt;archived: true&lt;/code&gt;, not because their commits dried up.&lt;/p&gt;

&lt;h3&gt;
  
  
  LinkedIn Oncall — nine months silent
&lt;/h3&gt;

&lt;p&gt;LinkedIn's Oncall was always a partial story. It's the rotation/calendar layer; you paired it with &lt;code&gt;linkedin/iris&lt;/code&gt; for actual paging. Two processes, MySQL underneath, a 2018-vintage UI. Acceptable trade-off if it shipped.&lt;/p&gt;

&lt;p&gt;It hasn't. Nine months without a commit on a tool that needs to keep up with Twilio API versions, Slack Block Kit revisions, and Prometheus AlertManager schema is a real risk. Open-issue count is 78. The &lt;code&gt;iris&lt;/code&gt; half (&lt;code&gt;linkedin/iris&lt;/code&gt;) shows similar stagnation.&lt;/p&gt;

&lt;p&gt;This is a textbook "acquihire-grade abandonment": a single open-source project that an internal team kept alive while a single maintainer was around, then stopped touching when that person rotated off. Not malicious, not formally dead — just no one driving.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cabot — repo no longer exists
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cabotapp/cabot&lt;/code&gt; returns &lt;strong&gt;404&lt;/strong&gt; from the GitHub API today. Renamed, deleted, or transferred to a private namespace — we genuinely don't know which.&lt;/p&gt;

&lt;p&gt;Cabot was the smallest install of the three: a Pingdom-plus-paging combo with just Postgres + Cabot. The minimal surface area made it attractive for tiny teams. But a 404 from &lt;code&gt;api.github.com/repos/cabotapp/cabot&lt;/code&gt; means no clone, no fork, no historical issue tracker. Whatever knowledge was in there is — for any practical self-host purpose — gone.&lt;/p&gt;

&lt;p&gt;We hold it as &lt;code&gt;unknown&lt;/code&gt; in our snapshot rather than promoting it to &lt;code&gt;dead&lt;/code&gt;, because someone might restore the namespace next month. But the 404 is itself the strongest "do not put this on a 2026 roadmap" signal we have.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the on-call vertical decays harder than most
&lt;/h2&gt;

&lt;p&gt;A few observations from staring at this category specifically:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;On-call tools live or die on integrations that age fast.&lt;/strong&gt; Twilio outbound API versions, Slack Block Kit, Prometheus AlertManager schema, PagerDuty's own webhook format for receiving migrations. Six months of maintainer silence and you've got at least one of those broken. A static site generator can ship a single commit a year and still be useful. An on-call tool cannot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The vendor money in this space is real.&lt;/strong&gt; PagerDuty, Splunk On-Call, Opsgenie, FireHydrant — all well-funded SaaS with vested interest in killing OSS competition. Grafana OnCall arcing into Grafana IRM is the textbook end state: get acquired-by-roadmap, archive the public repo, sell the same code as a hosted feature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;It's a high-trust install.&lt;/strong&gt; People deploy a status page on a whim. People do not deploy "the thing that decides who gets woken up at 3am" without serious vetting. So the user base of OSS on-call tools skews smaller and more demanding — which inverts the casual-contributor loop healthier OSS projects depend on.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The combination is brutal. You need ongoing integration maintenance, the vendors will hire away your one maintainer, and your user base is too small and too cautious to cushion the gap with PRs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you should actually self-host for paging in 2026
&lt;/h2&gt;

&lt;p&gt;Two real options, neither of which is on our /pagerduty/ page yet — this is a directory bug we'll fix in the next sweep:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Keep — &lt;code&gt;keephq/keep&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;11,805 stars, last commit yesterday (2026-05-09), AGPL-3.0&lt;/li&gt;
&lt;li&gt;Bills itself as the open-source AIOps and alert management platform. Modern stack (Python + Next.js), active Discord, regular releases.&lt;/li&gt;
&lt;li&gt;The clearest current self-host alternative to PagerDuty. Native integrations for Prometheus, Datadog, Sentry, Slack, Twilio. Workflow engine for routing rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fact that we hadn't surfaced this on our /pagerduty/ page when we wrote it is the editorial bug this whole post is paying off. The June 2026 sweep will add it.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Hand-rolled: AlertManager + a calendar + Twilio
&lt;/h3&gt;

&lt;p&gt;Deeply boring. Prometheus AlertManager handles routing. Google Calendar (or any calendar with an iCal feed) holds the rotation. A tiny webhook script translates &lt;em&gt;"AlertManager fired → who's on call right now per the calendar → Twilio outbound call/SMS"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Not a product. Not a deploy. A weekend script. But it's what a lot of small teams have actually converged on while waiting for the OSS on-call market to settle, and it has zero supply-chain dependency on anyone else's roadmap.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means if you trusted our /pagerduty/ page last week
&lt;/h2&gt;

&lt;p&gt;Honestly: the page is misleading right now. Our pill colors will tell you Grafana OnCall is dead, but the directory still lists it as the lead alternative. That's an editorial state we have to fix, not a "feature".&lt;/p&gt;

&lt;p&gt;This is exactly the failure mode a freshness-first directory is supposed to catch quickly — and the reason we built &lt;a href="https://code-rho-dun.vercel.app/graveyard/" rel="noopener noreferrer"&gt;the graveyard&lt;/a&gt; page (every dead/stale repo across our 100 SaaS pages, with backlinks to the SaaS each is listed under) and the &lt;a href="https://code-rho-dun.vercel.app/api/" rel="noopener noreferrer"&gt;public JSON API&lt;/a&gt; (so anyone aggregating us downstream gets the freshness signal too).&lt;/p&gt;

&lt;p&gt;If you were planning a 2026 PagerDuty migration and our /pagerduty/ page was your starting point — thank you for reading carefully. Your fallback today is Keep, or hand-rolled AlertManager + calendar + Twilio. Don't put &lt;code&gt;grafana/oncall&lt;/code&gt;, &lt;code&gt;linkedin/oncall&lt;/code&gt;, or &lt;code&gt;cabotapp/cabot&lt;/code&gt; on a 2026 self-host roadmap.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;This is the second post in the monthly snapshot series. The May post established the overall ~11% not-alive headline. This post zooms in on the worst category. Future posts in this series will cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first month-over-month diff (June 2026 — what flipped state)&lt;/li&gt;
&lt;li&gt;Linktree-style "link in bio" tools (BioDrop dead, littlelink stale — same pattern, smaller stakes)&lt;/li&gt;
&lt;li&gt;Form builders post-Typeform (ohmyform abandoned — what's actually shipping)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Want the diff post when it lands? Subscribe to the monthly digest from any &lt;a href="https://code-rho-dun.vercel.app/" rel="noopener noreferrer"&gt;SaaS page&lt;/a&gt; on the directory.&lt;/p&gt;

&lt;p&gt;We'd rather you find out from us than from a &lt;code&gt;git clone&lt;/code&gt; followed by a confused stare at the archive banner.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>selfhosted</category>
      <category>devops</category>
      <category>sre</category>
    </item>
    <item>
      <title>The `new` Keyword in JavaScript</title>
      <dc:creator>Pratham</dc:creator>
      <pubDate>Sun, 10 May 2026 10:23:31 +0000</pubDate>
      <link>https://popcorn.forem.com/pratham69/the-new-keyword-in-javascript-42ne</link>
      <guid>https://popcorn.forem.com/pratham69/the-new-keyword-in-javascript-42ne</guid>
      <description>&lt;p&gt;&lt;em&gt;How JavaScript creates objects from blueprints — and what actually happens behind the scenes.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;At some point in your JavaScript journey, you'll stop creating one-off objects and start thinking: "I need to create &lt;em&gt;many&lt;/em&gt; objects that all have the same structure." Ten users. Fifty products. A hundred tasks. Each one has the same properties — &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;email&lt;/code&gt;, &lt;code&gt;role&lt;/code&gt; — but with different values.&lt;/p&gt;

&lt;p&gt;You &lt;em&gt;could&lt;/em&gt; write each one by hand:&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;user1&lt;/span&gt; &lt;span class="o"&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;Pratham&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;admin&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;user2&lt;/span&gt; &lt;span class="o"&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;Arjun&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;editor&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;user3&lt;/span&gt; &lt;span class="o"&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;Priya&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;viewer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="c1"&gt;// ... 97 more?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That doesn't scale. What you actually want is a &lt;strong&gt;blueprint&lt;/strong&gt; — a template that says "every user has a name and a role" — and then a way to stamp out new objects from that blueprint. That's exactly what &lt;strong&gt;constructor functions&lt;/strong&gt; and the &lt;strong&gt;&lt;code&gt;new&lt;/code&gt;&lt;/strong&gt; keyword give you.&lt;/p&gt;

&lt;p&gt;This concept clicked for me during the ChaiCode Web Dev Cohort 2026, and it's one of those fundamentals that connects directly to how classes, React components, and object-oriented patterns work. Let me walk you through it.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Does the &lt;code&gt;new&lt;/code&gt; Keyword Do?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;new&lt;/code&gt; keyword creates a &lt;strong&gt;new object&lt;/strong&gt; from a constructor function. It automates a bunch of steps that you'd otherwise have to do manually.&lt;/p&gt;

&lt;p&gt;In one sentence: &lt;strong&gt;&lt;code&gt;new&lt;/code&gt; takes a blueprint (constructor function) and produces an instance (a new object) based on that blueprint.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of it like a cookie cutter. The constructor function is the cutter (the shape). Every time you press it into dough (use &lt;code&gt;new&lt;/code&gt;), you get a new cookie (a new object) — same shape, but each one is its own cookie.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Constructor Function (blueprint)
         ↓
     new keyword
         ↓
  New Object (instance)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Constructor Functions — The Blueprint
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;constructor function&lt;/strong&gt; is a regular function that's designed to be called with &lt;code&gt;new&lt;/code&gt;. By convention, constructor function names start with a &lt;strong&gt;capital letter&lt;/strong&gt; to distinguish them from regular functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic 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;function&lt;/span&gt; &lt;span class="nf"&gt;User&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="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;role&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;role&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;user1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;admin&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;user2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arjun&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;editor&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;user3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Priya&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;viewer&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;user1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// User { name: "Pratham", role: "admin" }&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;user2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// User { name: "Arjun", role: "editor" }&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;user3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// User { name: "Priya", role: "viewer" }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three objects, all with the same structure, created from one blueprint. Each one is its own independent object — changing &lt;code&gt;user1.name&lt;/code&gt; doesn't affect &lt;code&gt;user2&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Methods to the Constructor
&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;function&lt;/span&gt; &lt;span class="nf"&gt;User&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="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&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="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;`Hi, I'm &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&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="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pratham&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;pratham@prathamdev.in&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;pratham&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;// "Hi, I'm Pratham (pratham@prathamdev.in)"&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arjun&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arjun&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;arjun@example.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;arjun&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;// "Hi, I'm Arjun (arjun@example.com)"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each instance gets its own &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;email&lt;/code&gt;, and &lt;code&gt;greet&lt;/code&gt; method. The constructor function acts as a factory — you feed it values, and it produces fully formed objects.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Object Creation Process — Step by Step
&lt;/h2&gt;

&lt;p&gt;This is the part that most tutorials gloss over, but understanding &lt;em&gt;what &lt;code&gt;new&lt;/code&gt; actually does behind the scenes&lt;/em&gt; is what separates surface-level knowledge from real understanding.&lt;/p&gt;

&lt;p&gt;When you write &lt;code&gt;new User("Pratham", "admin")&lt;/code&gt;, JavaScript does &lt;strong&gt;four things&lt;/strong&gt; automatically:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create a New Empty Object
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// JavaScript internally does:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A brand-new, empty object is created. This is the object that will eventually be returned.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Link the Object's Prototype
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// JavaScript internally does:&lt;/span&gt;
&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;__proto__&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The new object's internal prototype is linked to the constructor function's &lt;code&gt;prototype&lt;/code&gt; property. This is how the object inherits shared methods (more on this shortly).&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Call the Constructor with &lt;code&gt;this&lt;/code&gt; = New Object
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// JavaScript internally does:&lt;/span&gt;
&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;admin&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;The constructor function runs, but &lt;code&gt;this&lt;/code&gt; inside it refers to the new empty object. So &lt;code&gt;this.name = name&lt;/code&gt; becomes &lt;code&gt;obj.name = "Pratham"&lt;/code&gt;, and the object gets populated with properties.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Return the New Object
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// JavaScript internally does:&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unless the constructor explicitly returns a different object, JavaScript automatically returns the newly created and populated object.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Complete Picture
&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;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nx"&gt;Step&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;empty&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt; &lt;span class="nx"&gt;created&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
             &lt;span class="err"&gt;↓&lt;/span&gt;
  &lt;span class="nx"&gt;Step&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="p"&gt;{}.&lt;/span&gt;&lt;span class="nx"&gt;__proto__&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prototype &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;linked&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
             &lt;span class="err"&gt;↓&lt;/span&gt;
  &lt;span class="nx"&gt;Step&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="nx"&gt;runs&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
           &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;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;Pratham&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
           &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;role&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
           &lt;span class="nx"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&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;Pratham&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
             &lt;span class="err"&gt;↓&lt;/span&gt;
  &lt;span class="nx"&gt;Step&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nx"&gt;Return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&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;Pratham&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nl"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="nx"&gt;user1&lt;/span&gt; &lt;span class="o"&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;Pratham&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;admin&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;h3&gt;
  
  
  Simulating &lt;code&gt;new&lt;/code&gt; Manually
&lt;/h3&gt;

&lt;p&gt;To really drive this home, here's what &lt;code&gt;new&lt;/code&gt; does — written as regular 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;fakeNew&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Constructor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Step 1: Create empty object&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;

  &lt;span class="c1"&gt;// Step 2: Link prototype&lt;/span&gt;
  &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setPrototypeOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Constructor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Step 3: Call constructor with this = obj&lt;/span&gt;
  &lt;span class="nx"&gt;Constructor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Step 4: Return the object&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;obj&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;User&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="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;role&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;role&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;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fakeNew&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;admin&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;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// { name: "Pratham", role: "admin" }&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;user&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true ✅&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That &lt;code&gt;fakeNew&lt;/code&gt; function does &lt;em&gt;exactly&lt;/em&gt; what &lt;code&gt;new&lt;/code&gt; does. Understanding these four steps means you truly understand &lt;code&gt;new&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Constructor → Instance Creation Flow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────────────────────────────┐
│                  Constructor Function                     │
│                                                           │
│   function Product(name, price) {                        │
│     this.name = name;                                     │
│     this.price = price;                                   │
│   }                                                       │
└────────────────────┬─────────────────────────────────────┘
                     │
         ┌───────────┼───────────┐
         ↓           ↓           ↓
    new Product  new Product  new Product
   ("Laptop",   ("Phone",    ("Headphones",
     75000)       25000)        3000)
         ↓           ↓           ↓
┌────────────┐ ┌────────────┐ ┌─────────────┐
│  Instance  │ │  Instance  │ │  Instance    │
│            │ │            │ │              │
│ name:      │ │ name:      │ │ name:        │
│  "Laptop"  │ │  "Phone"   │ │ "Headphones" │
│ price:     │ │ price:     │ │ price:       │
│  75000     │ │  25000     │ │  3000        │
└────────────┘ └────────────┘ └─────────────┘

One blueprint → many instances.
Each instance is independent.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How &lt;code&gt;new&lt;/code&gt; Links Prototypes
&lt;/h2&gt;

&lt;p&gt;Here's where things get powerful. Remember Step 2 — linking the prototype? This is how instances &lt;em&gt;share methods&lt;/em&gt; without duplicating them.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem Without Prototypes
&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;function&lt;/span&gt; &lt;span class="nf"&gt;User&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;this&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="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&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="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;`Hi, I'm &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;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="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;user2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arjun&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;user1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;user2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each instance gets its &lt;em&gt;own copy&lt;/em&gt; of the &lt;code&gt;greet&lt;/code&gt; function. If you create 1,000 users, that's 1,000 copies of the same function in memory. Wasteful.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution: Prototype Methods
&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;function&lt;/span&gt; &lt;span class="nf"&gt;User&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;this&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="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="c1"&gt;// Shared method — lives on the prototype, not on each instance&lt;/span&gt;
&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&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="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;`Hi, I'm &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;user2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arjun&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;user1&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;// "Hi, I'm Pratham"&lt;/span&gt;
&lt;span class="nx"&gt;user2&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;// "Hi, I'm Arjun"&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;user1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;user2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true! ✅ Same function in memory&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both instances use the &lt;em&gt;same&lt;/em&gt; &lt;code&gt;greet&lt;/code&gt; function from &lt;code&gt;User.prototype&lt;/code&gt;. One copy in memory, shared by all instances.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prototype Linking Visual
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                User.prototype
               ┌─────────────────────┐
               │ greet: function()   │  ← shared method (one copy)
               └──────────┬──────────┘
                          │
           ┌──────────────┼──────────────┐
           ↓              ↓              ↓
    ┌────────────┐  ┌────────────┐  ┌────────────┐
    │   user1    │  │   user2    │  │   user3    │
    │            │  │            │  │            │
    │ name:      │  │ name:      │  │ name:      │
    │ "Pratham"  │  │ "Arjun"    │  │ "Priya"    │
    │            │  │            │  │            │
    │ __proto__──┤  │ __proto__──┤  │ __proto__──┤
    │   → User  │  │   → User  │  │   → User  │
    │  .prototype│  │  .prototype│  │  .prototype│
    └────────────┘  └────────────┘  └────────────┘

    Each instance has its own "name" (data).
    All instances SHARE "greet" via the prototype chain.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you call &lt;code&gt;user1.greet()&lt;/code&gt;, JavaScript:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Looks for &lt;code&gt;greet&lt;/code&gt; on &lt;code&gt;user1&lt;/code&gt; → not found&lt;/li&gt;
&lt;li&gt;Follows &lt;code&gt;__proto__&lt;/code&gt; to &lt;code&gt;User.prototype&lt;/code&gt; → found!&lt;/li&gt;
&lt;li&gt;Runs it with &lt;code&gt;this&lt;/code&gt; = &lt;code&gt;user1&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is the &lt;strong&gt;prototype chain&lt;/strong&gt; — JavaScript's inheritance mechanism.&lt;/p&gt;




&lt;h2&gt;
  
  
  Instances Created from Constructors
&lt;/h2&gt;

&lt;p&gt;Every object created with &lt;code&gt;new&lt;/code&gt; is an &lt;strong&gt;instance&lt;/strong&gt; of its constructor. You can verify this with &lt;code&gt;instanceof&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;brand&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;brand&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;brand&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;model&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;myCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Toyota&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;Camry&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;myBike&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;brand&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Honda&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Activa&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;myCar&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true ✅&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;myBike&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false ❌&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;myCar&lt;/code&gt; was created with &lt;code&gt;new Car()&lt;/code&gt;, so it's an instance of &lt;code&gt;Car&lt;/code&gt;. &lt;code&gt;myBike&lt;/code&gt; is a plain object literal — no constructor involved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multiple Instances, Independent Data
&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;function&lt;/span&gt; &lt;span class="nf"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;complete&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;" marked as complete.`&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;task1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Learn JavaScript&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;high&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;task2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Write article&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;medium&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;task3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Push to GitHub&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;low&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;task1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// ✅ "Learn JavaScript" marked as complete.&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;task1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&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;task2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false — independent!&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;task3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false — independent!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each instance has its own data, but shares methods through the prototype. This is the foundation of object-oriented programming in JavaScript.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Happens Without &lt;code&gt;new&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;This is a common mistake — calling a constructor function &lt;em&gt;without&lt;/em&gt; &lt;code&gt;new&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;User&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;this&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="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="c1"&gt;// With new — works correctly&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&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;user1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// User { name: "Pratham" } ✅&lt;/span&gt;

&lt;span class="c1"&gt;// Without new — BAD!&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arjun&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;user2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined ❌&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&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="c1"&gt;// "Arjun" — accidentally polluted global scope!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without &lt;code&gt;new&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No new object is created&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;this&lt;/code&gt; becomes the global object&lt;/li&gt;
&lt;li&gt;Properties get attached to &lt;code&gt;window&lt;/code&gt; (in browsers)&lt;/li&gt;
&lt;li&gt;The function returns &lt;code&gt;undefined&lt;/code&gt; (no explicit return)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's why the capital-letter convention exists — it signals "use &lt;code&gt;new&lt;/code&gt; with this function." And that's why ES6 classes (which we'll cover later) enforce &lt;code&gt;new&lt;/code&gt; automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's Practice: Hands-On Assignment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Part 1: Create a Constructor Function
&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;function&lt;/span&gt; &lt;span class="nf"&gt;Student&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="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&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="k"&gt;this&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="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;course&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;introduce&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="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;`I'm &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;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="k"&gt;this&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="s2"&gt;, studying &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;course&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;h3&gt;
  
  
  Part 2: Create Multiple Instances
&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;s1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Pratham&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Web Dev Cohort 2026&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;s2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arjun&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Data Science&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;s3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Priya&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Machine Learning&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;introduce&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// "I'm Pratham, 22, studying Web Dev Cohort 2026."&lt;/span&gt;
&lt;span class="nx"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;introduce&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// "I'm Arjun, 21, studying Data Science."&lt;/span&gt;
&lt;span class="nx"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;introduce&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// "I'm Priya, 23, studying Machine Learning."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Part 3: Verify Instances and Shared Methods
&lt;/h3&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;s1&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&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;s2&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="c1"&gt;// All instances share the same introduce method&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;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;introduce&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;introduce&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true ✅&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;s2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;introduce&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;introduce&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true ✅&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Part 4: Add More Prototype Methods
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;changeCourse&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;newCourse&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;old&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;course&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newCourse&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="k"&gt;this&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; switched from &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;old&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; to &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;newCourse&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;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;changeCourse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Full-Stack Development&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// "Pratham switched from Web Dev Cohort 2026 to Full-Stack Development."&lt;/span&gt;

&lt;span class="nx"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;introduce&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// "I'm Pratham, 22, studying Full-Stack Development."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;new&lt;/code&gt;&lt;/strong&gt; keyword creates a new object from a constructor function. It automates object creation, prototype linking, and returning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constructor functions&lt;/strong&gt; are blueprints for creating multiple objects with the same structure. Name them with a capital letter by convention.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;new&lt;/code&gt; performs &lt;strong&gt;four steps&lt;/strong&gt;: create empty object → link prototype → run constructor with &lt;code&gt;this&lt;/code&gt; = new object → return the object.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prototype methods&lt;/strong&gt; are shared across all instances — one copy in memory instead of one per object. This is efficient and is the basis of JavaScript's inheritance.&lt;/li&gt;
&lt;li&gt;Every object created with &lt;code&gt;new&lt;/code&gt; is an &lt;strong&gt;instance&lt;/strong&gt; of its constructor, verifiable with &lt;code&gt;instanceof&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;new&lt;/code&gt; keyword is one of those foundational pieces that connects everything in JavaScript's object model. Constructor functions give you blueprints. &lt;code&gt;new&lt;/code&gt; gives you instances. Prototypes give you shared behavior. Together, they form the basis of object-oriented JavaScript — and they're exactly what ES6 classes are built on top of (classes are just syntactic sugar over constructors and prototypes).&lt;/p&gt;

&lt;p&gt;I'm learning all of this through the &lt;strong&gt;ChaiCode Web Dev Cohort 2026&lt;/strong&gt; under Hitesh Chaudhary and Piyush Garg, and understanding &lt;code&gt;new&lt;/code&gt; was the moment prototypes stopped being abstract theory and became something I could actually &lt;em&gt;use&lt;/em&gt;. If you're building towards classes and React, this is essential groundwork.&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.linkedin.com/in/pratham16" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; or visit &lt;a href="https://prathamdev.in" rel="noopener noreferrer"&gt;PrathamDEV.in&lt;/a&gt;. More articles on the way.&lt;/p&gt;

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




&lt;p&gt;&lt;em&gt;Written by Pratham Bhardwaj | Web Dev Cohort 2026, ChaiCode&lt;/em&gt;&lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>How Naver Leads Multimodal AI Search Innovation</title>
      <dc:creator>lifes koreaplus</dc:creator>
      <pubDate>Sun, 10 May 2026 10:20:39 +0000</pubDate>
      <link>https://popcorn.forem.com/koreaplus-lifes/how-naver-leads-multimodal-ai-search-innovation-22if</link>
      <guid>https://popcorn.forem.com/koreaplus-lifes/how-naver-leads-multimodal-ai-search-innovation-22if</guid>
      <description>&lt;p&gt;The tech world is currently buzzing with the rapid advancements in multimodal AI – systems that seamlessly understand and process text, images, audio, and even video. From OpenAI's GPT-4V to Google's Gemini, the promise of more intuitive and context-aware interactions is finally becoming a tangible reality. As engineers, we're keenly watching how these innovations will reshape user experiences and development paradigms. But what if I told you that a major player has been quietly perfecting this art, integrating sophisticated multimodal understanding into its core services for over a decade, long before it became a global buzzword? Enter Naver, South Korea's leading internet company, whose journey offers invaluable lessons for anyone building the next generation of AI-powered platforms.&lt;/p&gt;

&lt;h2&gt;Pioneering Multimodal Fusion in the Early Days&lt;/h2&gt;

&lt;p&gt;A decade ago, the landscape for building advanced AI was vastly different. Computational resources were scarcer, deep learning frameworks were nascent, and large-scale multimodal datasets were a distant dream. This is precisely the challenging environment in which Naver began its deep dive into multimodal AI. While global giants are now rolling out advanced features, Naver was solving the fundamental engineering problems of integrating disparate data streams – text from queries, images from user uploads, audio from voice commands – into a cohesive search experience. This wasn't about simply adding a visual search tab; it was about truly fusing these modalities at a deeper, semantic level within their search engine architecture.&lt;/p&gt;

&lt;p&gt;The technical implications of this early commitment are profound. It necessitated significant in-house research and development into cross-modal embedding techniques, robust data pipelines capable of handling diverse formats at scale, and custom model architectures designed for efficient inference across multiple input types. Imagine building a recommendation engine that doesn't just look at product descriptions, but also visually analyzes product images and understands the emotional tone of user reviews, all while ensuring low latency for millions of users. Naver’s engineering teams had to develop proprietary solutions for aligning feature spaces from different modalities, allowing their systems to derive a richer, more contextual understanding of user intent and information relevance, long before off-the-shelf solutions were available.&lt;/p&gt;

&lt;h2&gt;Engineering for Deep Contextual Understanding&lt;/h2&gt;

&lt;p&gt;The real power of Naver's decade-long investment isn't just in *what* they built, but *how* it translated into a deeply contextual and intuitive user experience. For a developer, this means moving beyond keyword matching or simple image recognition. It implies a system that can understand a query like "show me restaurants near here with outdoor seating that are dog-friendly" and instantly filter results by combining location data, image analysis (to identify outdoor seating in restaurant photos), and text analysis of reviews (for "dog-friendly" mentions). This level of contextual understanding requires a sophisticated interplay of natural language processing (NLP), computer vision (CV), and speech recognition (ASR) modules, all contributing to a unified understanding of the user's need.&lt;/p&gt;

&lt;p&gt;Naver's approach demonstrates a critical engineering insight: multimodal AI is not just about stacking models, but about creating synergistic feedback loops. Their search engine, for instance, learns from how users interact with image results after a text query, or how voice queries lead to specific video consumption. This continuous learning, fueled by a vast, diverse dataset gathered over many years across services like search, e-commerce, and mapping, has allowed them to refine their cross-modal representations and fusion strategies. This iterative process of data collection, model training, deployment, and feedback loop closure is the bedrock of their advanced, intuitive platforms, providing a blueprint for how to build truly intelligent systems that anticipate user needs rather than just reacting to explicit inputs.&lt;/p&gt;

&lt;h2&gt;The Data Moat and Future-Proofing AI&lt;/h2&gt;

&lt;p&gt;A decade of multimodal data collection and model refinement has created a formidable "data moat" for Naver. This isn't just about having a lot of data; it's about having *diverse, interconnected* multimodal data, meticulously curated and tagged from real-world user interactions across a rich ecosystem of services. This proprietary dataset is a goldmine for training and fine-tuning advanced foundational models, giving Naver a distinct advantage in developing highly specialized and accurate AI for the Korean language and cultural context, which is often a challenge for global models.&lt;/p&gt;

&lt;p&gt;From an engineering perspective, this deep data resource enables faster iteration, more robust model performance, and the ability to explore cutting-edge AI applications from a position of strength. It means they can push the boundaries into areas like hyper-personalized content generation, advanced conversational AI, and even sophisticated AI-powered content moderation, all underpinned by a holistic understanding of information across modalities. Naver's journey illustrates that while foundational models are powerful, the true competitive edge in the AI era will increasingly belong to those who can effectively leverage their unique data assets and integrate multimodal intelligence deeply into their platform architecture, preparing them for the next wave of AI innovation, whether it's embodied AI or advanced synthetic media generation.&lt;/p&gt;

&lt;p&gt;For the full deep-dive — market data, company financials, and strategic analysis — &lt;a href="https://koreaplus-lifes.com/naver-multimodal-ai-search-innovation/" rel="noopener noreferrer"&gt;read the complete article on KoreaPlus&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>naver</category>
      <category>koreantech</category>
      <category>innovation</category>
    </item>
  </channel>
</rss>
