<?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 Vithushan Logeswaran on Medium]]></title>
        <description><![CDATA[Stories by Vithushan Logeswaran on Medium]]></description>
        <link>https://medium.com/@vithushan-techmentor?source=rss-e230e56a9c64------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vkBxhDGU3k2OaZKo3yChsQ.png</url>
            <title>Stories by Vithushan Logeswaran on Medium</title>
            <link>https://medium.com/@vithushan-techmentor?source=rss-e230e56a9c64------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:49:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vithushan-techmentor/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[How JavaScript Stores Variables: Stack vs Heap Explained Simply]]></title>
            <link>https://vithushan-techmentor.medium.com/how-javascript-stores-variables-stack-vs-heap-explained-simply-61f7be87053b?source=rss-e230e56a9c64------2</link>
            <guid isPermaLink="false">https://medium.com/p/61f7be87053b</guid>
            <dc:creator><![CDATA[Vithushan Logeswaran]]></dc:creator>
            <pubDate>Wed, 22 Apr 2026 09:04:31 GMT</pubDate>
            <atom:updated>2026-04-22T09:04:31.929Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started learning JavaScript, one question confused me a lot:</p><p><strong>Where does a variable actually get stored in memory?</strong></p><p>I kept hearing words like <strong>stack</strong> and <strong>heap</strong>, but they sounded more complicated than they really are.</p><p>So here is the simple version.</p><h3>The basic idea</h3><p>In JavaScript, variables are stored in memory in two common ways:</p><ul><li><strong>Stack</strong> → used for simple values</li><li><strong>Heap</strong> → used for complex values</li></ul><p>This helps JavaScript manage memory efficiently.</p><h3>1. Stack memory</h3><p>The <strong>stack</strong> is used for storing <strong>primitive values</strong>.</p><p>Primitive values in JavaScript are:</p><ul><li>string</li><li>number</li><li>boolean</li><li>null</li><li>undefined</li><li>bigint</li><li>symbol</li></ul><p>These values are small, fixed in size, and easy to store directly.</p><h3>Example:</h3><pre>let name = &quot;John&quot;;<br>let age = 25;<br>let isActive = true;</pre><p>Here:</p><ul><li>name stores &quot;John&quot;</li><li>age stores 25</li><li>isActive stores true</li></ul><p>These are stored directly in stack memory.</p><p>The stack is fast because it handles simple data in an organized way.</p><h3>2. Heap memory</h3><p>The <strong>heap</strong> is used for storing <strong>reference types</strong>.</p><p>Reference types in JavaScript are:</p><ul><li>object</li><li>array</li><li>function</li></ul><p>These values can be bigger and more complex, so JavaScript stores them in the heap.</p><p>But there is one important detail:</p><p>The actual object is stored in the <strong>heap</strong>, and the variable stores only a <strong>reference</strong> (or address) to that object.</p><h3>Example:</h3><pre>let user = {<br>  name: &quot;John&quot;,<br>  age: 25<br>};</pre><p>Here:</p><ul><li>the user object is stored in the <strong>heap</strong></li><li>the variable user holds a reference to that memory location</li></ul><p>So user does not store the full object directly in the stack like a primitive value.</p><h3>Why this matters</h3><p>This difference becomes very important when copying variables.</p><h3>Primitive copy example</h3><pre>let a = 10;<br>let b = a;<br><br>b = 20;<br>console.log(a); // 10<br>console.log(b); // 20</pre><p>Why?</p><p>Because primitive values are copied by <strong>value</strong>.</p><p>That means b gets its own separate copy of a.</p><p>Changing b does not affect a.</p><h3>Object copy example</h3><pre>let person1 = { name: &quot;John&quot; };<br>let person2 = person1;<br><br>person2.name = &quot;David&quot;;<br><br>console.log(person1.name); // David<br>console.log(person2.name); // David</pre><p>Why did both change?</p><p>Because objects are copied by <strong>reference</strong>.</p><p>Both person1 and person2 point to the same object in heap memory.</p><p>So when one changes the object, the other sees the same change.</p><h3>Easy way to remember</h3><p>Think of it like this:</p><ul><li><strong>Stack</strong> = stores the actual simple value</li><li><strong>Heap</strong> = stores the actual complex object</li><li>variable = stores the reference to that object</li></ul><h3>Real-world analogy</h3><p>Imagine a house address.</p><ul><li>The <strong>house</strong> is the actual object in the heap</li><li>The <strong>address written on paper</strong> is the reference</li><li>The variable only keeps that address</li></ul><p>So if two people have the same address, both can go to the same house.</p><p>That is exactly how object references work in JavaScript.</p><h3>Final thought</h3><p>Understanding stack and heap makes JavaScript much easier to reason about.</p><p>If a variable stores a <strong>primitive</strong>, JavaScript usually keeps the value directly.</p><p>If a variable stores an <strong>object, array, or function</strong>, JavaScript stores the real data in the heap and keeps a reference.</p><p>Once you understand this, concepts like copying, mutation, and passing values become much clearer.</p><p><strong>In simple words:</strong><br> Primitive values are copied by value, and objects are copied by reference.</p><p>That is one of the most important memory concepts in JavaScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61f7be87053b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How JavaScript Runs Behind the Scenes: From Code to Machine Execution]]></title>
            <link>https://vithushan-techmentor.medium.com/how-javascript-runs-behind-the-scenes-from-code-to-machine-execution-8bf8408121bb?source=rss-e230e56a9c64------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bf8408121bb</guid>
            <category><![CDATA[bytecode]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Vithushan Logeswaran]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 17:05:44 GMT</pubDate>
            <atom:updated>2026-04-21T17:05:44.806Z</atom:updated>
            <content:encoded><![CDATA[<p>When we write JavaScript, it feels very simple.</p><p>We write some code, run it in the browser or Node.js, and get the output. But behind the scenes, many things happen before the computer actually runs that code.</p><p>Many people think JavaScript goes directly from source code to machine code. But that is not exactly true. Modern JavaScript engines use a smarter process to make JavaScript both fast and flexible.</p><p>Let’s understand that journey in a simple way.</p><h3>1. We Write JavaScript Code</h3><p>Here is a simple example:</p><pre>function add(a, b) {<br>  return a + b;<br>}<br>console.log(add(2, 3));</pre><p>This is called <strong>source code</strong>.</p><p>It is easy for humans to read, but the computer cannot understand this code directly in the same way we do. So the JavaScript engine starts processing it step by step.</p><h3>2. The Engine Parses the Code</h3><p>The first step is called <strong>parsing</strong>.</p><p>In this stage, the JavaScript engine checks whether the code follows the correct JavaScript syntax.</p><p>For example, if you forget a bracket or write something invalid, the code will fail here itself.</p><p>So parsing is like a grammar check for your JavaScript code.</p><h3>3. It Creates an AST</h3><p>After parsing, the engine creates something called an <strong>AST</strong>, which means <strong>Abstract Syntax Tree</strong>.</p><p>The name may sound complex, but the idea is simple.</p><p>It is just a structured version of your code that helps the engine understand what each part means.</p><p>For example, the engine understands:</p><ul><li>This is a function</li><li>These are parameters</li><li>This is a return statement</li><li>This is an addition operation</li></ul><p>So you can think of the AST as a map of your code.</p><h3>4. The Engine Converts It into Bytecode</h3><p>Next, the JavaScript engine converts the code into <strong>bytecode</strong>.</p><p>Bytecode is not yet machine code. It is an intermediate format that sits between human-readable code and CPU instructions.</p><p>You can think of it like this:</p><ul><li><strong>Source code</strong> = human-friendly</li><li><strong>Bytecode</strong> = engine-friendly</li><li><strong>Machine code</strong> = CPU-friendly</li></ul><p>This step helps the engine prepare the code for execution.</p><h3>5. The Interpreter Starts Running It</h3><p>After generating bytecode, the engine starts running it with the help of an <strong>interpreter</strong>.</p><p>This is important because JavaScript does not wait to fully compile everything before starting. Instead, it begins execution quickly.</p><p>That is one of the reasons JavaScript feels fast and responsive, especially in browsers.</p><h3>6. Frequently Used Code Gets Optimized</h3><p>Now comes the interesting part.</p><p>If some code runs again and again, the engine notices it.</p><p>Example:</p><pre>function multiply(a, b) {<br>  return a * b;<br>}<br><br>for (let i = 0; i &lt; 1000000; i++) {<br>  multiply(2, 3);<br>}</pre><p>Here, the multiply() function is used many times.</p><p>So the engine treats it as important code and says, “This part is being used a lot. Let me make it faster.”</p><p>Then it uses <strong>JIT compilation</strong>, which stands for <strong>Just-In-Time compilation</strong>, to convert that frequently used code into optimized machine code.</p><p>This is how JavaScript improves performance while the program is running.</p><h3>7. Machine Code Runs on the CPU</h3><p>Finally, the optimized machine code is executed by the CPU.</p><p>This is the stage where the actual hardware performs the work.</p><p>So the full journey looks like this:</p><p><strong>JavaScript code → Parsing → AST → Bytecode → Interpreter → Optimized machine code → CPU</strong></p><h3>Why This Matters</h3><p>This whole process is the reason JavaScript is both flexible and fast.</p><p>It starts quickly, then becomes faster by optimizing the parts of the code that are used often.</p><p>So JavaScript is not simply “read and run.” There is a smart engine behind it that is constantly working to understand, execute, and optimize your code.</p><h3>Final Thoughts</h3><p>When we write JavaScript, a lot of hidden work happens behind the scenes before the code reaches the CPU.</p><p>First, the code is checked. Then it is understood, converted into internal formats, interpreted, and later optimized into machine code for better speed.</p><p>That is the magic happening every time we run JavaScript.</p><p>The next time you write a simple console.log() or a function, just remember that a powerful engine is doing a lot of work in the background to make your code run smoothly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bf8408121bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Any master plan behind this seen?]]></title>
            <link>https://vithushan-techmentor.medium.com/any-master-plan-behind-this-seen-57f284f18b44?source=rss-e230e56a9c64------2</link>
            <guid isPermaLink="false">https://medium.com/p/57f284f18b44</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[larry-page]]></category>
            <category><![CDATA[sundar-pichai]]></category>
            <category><![CDATA[sergey-brin]]></category>
            <dc:creator><![CDATA[Vithushan Logeswaran]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 04:24:11 GMT</pubDate>
            <atom:updated>2021-01-18T06:32:46.325Z</atom:updated>
            <content:encoded><![CDATA[<p>An own overview</p><figure><img alt="Sundar pichai" src="https://cdn-images-1.medium.com/max/1024/1*UMD-2kEPAvPVmOXPGdH2ZQ.jpeg" /><figcaption>Sundar Pichai</figcaption></figure><h3>Why is Sundar Pichai replacing Larry Page as the CEO of Alphabet?</h3><p>Because Sundar Pichai can do a better job running Alphabet and Google than Larry and Sergey. Larry and Sergey are intellectually honest and know it is time for a change. The reality is running Google is not fun anymore. It is a massive company with over <strong>100,000 </strong>employees, and has all the social and political problems that come with that size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rrUKSkm5MwvuirSAlNaFtw.jpeg" /><figcaption><strong>Larry Page &amp; Sergey brin</strong></figcaption></figure><p>Larry and Sergey are not egomaniacs that must hold onto power to be satisfied. They enjoy being creative, solving hard technical problems, and learning new things. After 20 years running Google they have nothing left to prove</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8QtsyzR-ZfKuUUss07HEeQ.jpeg" /><figcaption>Sundar pichai</figcaption></figure><p>Running Google is hard and often frustrating work. Politicians and the media are constantly attacking Google. Sundar has had to deal with big challenges with the EU and other regulatory agencies, political issues, and legal challenges. Competing with Apple iPhone versus Android, AWS vs Google Cloud, and all the challengers to <strong>YouTube, Google Search, Gmail, Google Maps,</strong> etc is a daunting task. Larry and Sergey really don’t like dealing with all that. Sundar has handled all of them with grace and determination.</p><h3><strong><em>“As a leader, It is important to not just see your own success, but focus on the success of others.”</em></strong></h3><p><strong><em>-Sundar pichai</em></strong></p><p>After 20 years it was time for a change. Sundar Pichai is the right man for the job &amp; he has plenty of skills to manage threats and problems. He is loving his job that is the main reason for it &amp; he never disappointed. In cricket the one word that is said by all that is “<strong>ONE MAN SHOW</strong>“, i think this is more suitable for Sundar pichai.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57f284f18b44" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>