<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Saarock on Medium]]></title>
        <description><![CDATA[Stories by Saarock on Medium]]></description>
        <link>https://medium.com/@saarock?source=rss-9b9c0372e492------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*N5UarLlXoFHJ3ZN1Px78-g.png</url>
            <title>Stories by Saarock on Medium</title>
            <link>https://medium.com/@saarock?source=rss-9b9c0372e492------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:49:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saarock/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Behind the Scenes of JavaScript: The Engine That Runs the Show]]></title>
            <link>https://saarock.medium.com/behind-the-scenes-of-javascript-the-engine-that-runs-the-show-fb681f113dfe?source=rss-9b9c0372e492------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb681f113dfe</guid>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[js-scope]]></category>
            <category><![CDATA[v8-engine]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[interpreters]]></category>
            <dc:creator><![CDATA[Saarock]]></dc:creator>
            <pubDate>Tue, 10 Jun 2025 06:57:41 GMT</pubDate>
            <atom:updated>2025-06-10T07:23:18.531Z</atom:updated>
            <content:encoded><![CDATA[<p>In my words, there are two types of programmers in this world:</p><ol><li>Just programmers</li><li>JavaScript programmers</li></ol><p>Sounds cool, right? I know 😄</p><p>JavaScript has a massive developer base, but many JavaScript developers aren’t aware of the deeper concepts behind how JavaScript actually works. For example:</p><ol><li>Does the JS engine use a compiler or an interpreter?</li><li>What happens behind the scenes when we run JavaScript code?</li></ol><p>These questions often confuse developers — and that’s completely fine! Today, let’s dive deep into how the JavaScript engine works and clear up the mystery.</p><h4>What is the JavaScript Engine?</h4><p>In my opinion, the JS engine is like a human body. It contains many internal systems working together behind the scenes. These systems help determine whether JavaScript is a compiled or interpreted language (spoiler: it’s a mix of both!).</p><p>Let’s break it down through <strong>Compiler Theory</strong>.</p><h4>Compiler Theory in JS Engines</h4><p>There are <strong>three main phases</strong> in traditional compiler theory:</p><h4>1. Tokenizing and Lexing</h4><p>These are two closely related stages.<br> When you write code like var a = 46;, the engine breaks it down into individual tokens:<br> var, a, =, 46, and ;</p><ol><li><strong>Tokenizing</strong> breaks the source code into tokens.</li><li><strong>Lexing</strong> (or lexical analysis) classifies those tokens. For example, it determines whether a is a variable name, or whether 46 is a number or a string.</li></ol><h4>2. Parsing</h4><p>Parsing takes the tokens generated from the lexer and builds an <strong>AST (Abstract Syntax Tree)</strong>.<br> This tree structure represents the syntax of the code and helps the engine understand the logic.</p><h4>3. Code Generation</h4><p>The final step is generating <strong>machine code</strong> that your computer can execute.<br> This is where execution actually begins.</p><h4>Types of Compilers in JS Engines</h4><p>Modern JS engines use multiple compilation strategies:</p><ol><li><strong>JIT (Just-In-Time Compiler):</strong> Compiles code on the fly as it’s needed.</li><li><strong>Lazy Compiler:</strong> Compiles only the parts of code that are required immediately.</li><li><strong>Hot Recompilation:</strong> Optimizes and recompiles frequently used (hot) code paths for better performance.</li></ol><h4>Understanding Scope in JavaScript</h4><p>Scope is one of the most vital concept in the javaScript.</p><pre>function parent() {<br> var a = 23; // Function scope<br>}</pre><p>In the example above, a is accessible only within the parent function. This is called <strong>function scope</strong>.</p><h4>Nested Scope and Closures</h4><pre>function parent() {<br>  let a = 23;<br>  return function child() {<br>    console.log(a);<br>  };<br>}</pre><p>Here’s what happens:</p><ol><li>The child function is defined inside the parent function.</li><li>When child() tries to access a, it first looks in its own scope.<br> If it doesn&#39;t find a, it looks up to its <strong>lexical (parent) scope</strong>, where it finds a = 23.</li></ol><h4>RHS and LHS Operations [Lookup]</h4><p>JavaScript engines handle two main types of operations:</p><ol><li><strong>RHS (Right-Hand Side):</strong> Reading a value from memory.<br> E.g., console.log(a) → engine tries to retrieve the value of a.</li><li><strong>LHS (Left-Hand Side):</strong> Assigning a value to memory.<br> E.g., a = 10 → engine assigns 10 to the variable a</li></ol><h4>The Three Cast Members of JavaScript Execution [Three Friends].</h4><p>Think of JS execution as a play with <strong>three characters</strong>:</p><ol><li><strong>Engine:</strong></li></ol><blockquote>Responsible for start-to-finish compilation and execution of our JavaScript program.</blockquote><p>Think engine like a chef in a Kitchen who takes a receipe (<strong> your JS code</strong> ), understands it , prepares all the ingredients, cooks it and serves the final dish</p><p><strong>2. Compiler:</strong><br> Takes the code and performs tokenizing, lexing, and parsing to build the AST.</p><p><strong>3. Scope:</strong><br> The genius of the team. It decides whether a variable should be retrieved (RHS) or assigned (LHS) and manages memory accordingly.</p><h4>Final Thoughts</h4><p>Many developers write JavaScript daily without fully understanding how it runs under the hood. But once you explore the inner workings like compiler phases, scoping, and execution flow — you’ll become a more confident and capable JavaScript developer.</p><p>So next time someone asks,</p><blockquote><em>“Is JavaScript compiled or interpreted?”</em></blockquote><p>You can confidently say:<br> <strong>It’s both — thanks to modern engines like V8 that use JIT compilation techniques.</strong></p><p>Keep exploring, and never stop being curious. That’s the true spirit of a JavaScript programmer!</p><blockquote>Many of the insights I’ve shared here are inspired by the amazing book series <strong>“You Don’t Know JS” by Kyle Simpson</strong> — a must-read for any serious JavaScript developer.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb681f113dfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to start learning JavaScript for beginners.]]></title>
            <link>https://saarock.medium.com/how-to-start-learning-javascript-for-beginners-c93ff5e611ce?source=rss-9b9c0372e492------2</link>
            <guid isPermaLink="false">https://medium.com/p/c93ff5e611ce</guid>
            <category><![CDATA[motivational]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[storyofmylife]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <dc:creator><![CDATA[Saarock]]></dc:creator>
            <pubDate>Thu, 01 Aug 2024 06:16:23 GMT</pubDate>
            <atom:updated>2024-08-02T04:20:42.282Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript is most beautiful programming language which is versatile. This looks most simple programming language but when we deep dive on it we realize it is now most confusing language and many beginners get frustrated and switch .</p><blockquote>When i start programming first i don’t have any idea about programming languages. My elder brother prefer <a href="https://en.wikipedia.org/wiki/PHP"><strong><em>PHP </em></strong></a>but I don’t get it and started learning html. W3-School and Thapa technical (Youtube channel) were my first teachers they help’s me a lot at the starting phase so heartly thank’s to them. I started learning html from w3-school till i don’t have any idea about the web apps , mobile apps but i continuously started learning. After html from the w3-school i get to know there is something called JavaScript so i started learning it without knowing CSS. When I get familiar to basic syntax of the JavaScript like functions, variables, operators, i started to make projects by watching Thapa technical video’s and i created many project’s many times. Same project’s i created 2 ,3 time till i can make it without any reference this helps me to get confident and keep’s me motivate which is most important for any developer. After some basic project like calculator’s , snake games , todo apps, and image downloader, i want to deep dive in the javascript because it touch my heart and i can write javascript at any time, at any situation i always love to write javascript. Till now not much 2.5 year of my journey i get to learn javascript very deeply. But still i am not perfect i want to get always more for quality software’s. I already have knowledge of the JavaScript because i learned it already now i want to understand JavaScript not learn .</blockquote><p>Just like my short story always try to learn less but learn effectively and don’t think about other technologies. Start from the basic topic like functions, operators, loop, control flow statement, variables and try to control html from the javascript learn DOM objects , BOM object not all only learn that you need.Create some basic project’s, create many time’s same projects till you don’t get confident. Don’t get hyper while learning by looking other’s. The time will change and i believe that with consistency any thing is possible. So, focus on one thing just JavaScript if you are learning it.</p><p><strong>First learn then understand.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c93ff5e611ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>