<?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[JAVASCRIPT AMAZING KEYS - Medium]]></title>
        <description><![CDATA[Top 30 JavaScript concepts You need to Master to Become an Expert - Medium]]></description>
        <link>https://medium.com/javascript-amazing-keys?source=rss----db6cbac2fced---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>JAVASCRIPT AMAZING KEYS - Medium</title>
            <link>https://medium.com/javascript-amazing-keys?source=rss----db6cbac2fced---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 15:01:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/javascript-amazing-keys" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Primitive Data Types]]></title>
            <link>https://medium.com/javascript-amazing-keys/primitive-data-types-83d99f236b12?source=rss----db6cbac2fced---4</link>
            <guid isPermaLink="false">https://medium.com/p/83d99f236b12</guid>
            <category><![CDATA[primitive-data]]></category>
            <category><![CDATA[primitive-data-types]]></category>
            <category><![CDATA[primitive]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Tue, 04 Aug 2020 12:03:10 GMT</pubDate>
            <atom:updated>2020-08-04T12:03:09.978Z</atom:updated>
            <content:encoded><![CDATA[<p>In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods. There are 6 primitive data types: string, number, bigint, boolean, undefined, and symbol. There also is null, which is seemingly primitive, but indeed is a special case for every Object: and any structured type is derived from null by the Prototype Chain.</p><p>Most of the time, a primitive value is represented directly at the lowest level of the language implementation.</p><p>All primitives are immutable, i.e., they cannot be altered. It is important not to confuse a primitive itself with a variable assigned a primitive value. The variable may be reassigned a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be altered.</p><h3>Example</h3><p>This example will help you understand the fact that primitive values are <strong>immutable.</strong></p><p>// Using a string method doesn&#39;t mutate the string<br>var bar = &quot;baz&quot;;<br>console.log(bar); // baz<br>bar.toUpperCase();<br>console.log(bar); // baz</p><pre>// Using an array method mutates the array<br>var foo = [];<br>console.log(foo);               // []<br>foo.push(&quot;plugh&quot;);<br>console.log(foo);               // [&quot;plugh&quot;]</pre><pre>// Assignment gives the primitive a new (not a mutated) value<br>bar = bar.toUpperCase();       // BAZ</pre><p>A primitive can be replaced, but it can’t be directly altered.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83d99f236b12" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javascript-amazing-keys/primitive-data-types-83d99f236b12">Primitive Data Types</a> was originally published in <a href="https://medium.com/javascript-amazing-keys">JAVASCRIPT AMAZING KEYS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Call Stack Execution]]></title>
            <link>https://medium.com/javascript-amazing-keys/call-stack-execution-849674d5213c?source=rss----db6cbac2fced---4</link>
            <guid isPermaLink="false">https://medium.com/p/849674d5213c</guid>
            <category><![CDATA[call-stack-js]]></category>
            <category><![CDATA[call-stack]]></category>
            <category><![CDATA[javascrpt-call-stack]]></category>
            <category><![CDATA[javascript-call-stack]]></category>
            <dc:creator><![CDATA[Rahul Kumar]]></dc:creator>
            <pubDate>Tue, 04 Aug 2020 11:55:40 GMT</pubDate>
            <atom:updated>2020-08-04T11:55:40.721Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript engine uses a <strong>call stack</strong> to manage Execution Context : the Global Execution Context and Function Execution Contexts.</p><p>The call stack works based on the LIFO principle i.e., last-in-first-out.</p><p>When you execute a script, the JavaScript engine creates a Global Execution Context and pushes it on top of the call stack.Whenever a function is called, the JavaScript engine creates a Function Execution Context for the function, pushes it on top of the Call Stack, and starts executing the function.If a function calls another function, the JavaScript engine creates a new Function Execution Context for the function that is being called and pushes it on top of the call stack.When the current function completes, the JavaScript engine pops it off the call stack and resumes the execution where it left off in the last code listing.</p><p>The script will stop when the call stack is empty.</p><h3>JavaScript call stack example</h3><p>function add(a, b) {<br> return a + b;<br>}</p><p>function average(a, b) {<br> return add(a, b) / 2;<br>}</p><p>let x = average(10, 20);</p><p>When the script runs, the JavaScript engine places the global execution context (denoted by main() or global() function on the call stack.</p><figure><img alt="Main call stack" src="https://cdn-images-1.medium.com/max/162/1*pSLs_wBi4cOOCSByWjdRnQ.png" /><figcaption>main() as call stack</figcaption></figure><p>The global execution context enters the creation phase and moves to the execution phase.</p><p>The JavaScript engine executes the call to the average(10, 20) function and creates a function execution context for the average() function and pushes it on top of the call stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/1*wcmlbIPvLSgLpQRS_DQsDw.png" /><figcaption>average() as call stack</figcaption></figure><p>The JavaScript engine starts executing the average() since it is at the top of the call stack.</p><p>The average() function calls add() function. At this point, the JavaScript engine creates another function execution context for the add() function and places it on the top of the call stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/163/1*euJVDP9RGKVkpwjXMykQAw.png" /><figcaption>add() in execution context</figcaption></figure><p>JavaScript engine executes the add() function and pops it off the call stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/1*wcmlbIPvLSgLpQRS_DQsDw.png" /><figcaption>add() finished</figcaption></figure><p>At this point, the average() function is on top of the call stack, JavaScript engine executes it and pops it off the call stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/1*pSLs_wBi4cOOCSByWjdRnQ.png" /><figcaption>Average() finished</figcaption></figure><p>Now, the call stack is empty so the script stops executing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/163/1*w0T6VLlHR_5pdAHWekyYfw.png" /><figcaption>empty call stack</figcaption></figure><h3>Stack overflow</h3><p>The call stack has a fixed size, depending on the implementation of the host environment, either the web browser or Node.js.</p><p>If the number of the execution contexts exceeds the size of the stack, a stack overflow will occur.</p><p>For example, when you execute a recursive function that has no exit condition, it will result in a stack overflow error:</p><pre>function foo() {<br>    foo();<br>}</pre><pre>foo(); <em>// stack overflow</em></pre><h3>Asynchronous JavaScript</h3><p>JavaScript is the single-threaded programming language. The JavaScript engine has only one call stack so that it only can do one thing at a time.</p><p>When executing a script, the JavaScript engine executes code from top to bottom, line by line. In other words, it is synchronous.</p><p>Asynchronous is the opposite of synchronous, which means happening at the same time. So how does JavaScript carry asynchronous tasks such as callbacks, <a href="https://www.javascripttutorial.net/es6/javascript-promises/">promises</a>, and <a href="https://www.javascripttutorial.net/es-next/javascript-async-await/">async/await</a>? This is where the event loop comes into the picture that we will cover in the <a href="https://www.javascripttutorial.net/javascript-event-loop/">next tutorial</a>.</p><p>In this tutorial, you have learned about the JavaScript call stack that helps keep track of the execution contexts or function calls.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=849674d5213c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javascript-amazing-keys/call-stack-execution-849674d5213c">Call Stack Execution</a> was originally published in <a href="https://medium.com/javascript-amazing-keys">JAVASCRIPT AMAZING KEYS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>