<?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 Shubhvrat kulkarni on Medium]]></title>
        <description><![CDATA[Stories by Shubhvrat kulkarni on Medium]]></description>
        <link>https://medium.com/@shubhavratkulkarni?source=rss-4e2e2805efe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Scjh6GccFLth72cOtmryYg@2x.jpeg</url>
            <title>Stories by Shubhvrat kulkarni on Medium</title>
            <link>https://medium.com/@shubhavratkulkarni?source=rss-4e2e2805efe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:29:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shubhavratkulkarni/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[JavaScript — Behind the scenes]]></title>
            <link>https://medium.com/front-end-weekly/javascript-behind-the-scenes-df44f9dd1c42?source=rss-4e2e2805efe------2</link>
            <guid isPermaLink="false">https://medium.com/p/df44f9dd1c42</guid>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shubhvrat kulkarni]]></dc:creator>
            <pubDate>Thu, 22 Feb 2024 23:40:10 GMT</pubDate>
            <atom:updated>2024-02-22T23:40:10.312Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript — Behind the scenes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FqVsJThat5rZDM5b" /><figcaption>Photo by <a href="https://unsplash.com/@pinjasaur?utm_source=medium&amp;utm_medium=referral">Paul Esch-Laurent</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>JavaScript is a Single Threaded , Synchronous Language.</p><p>Everything in JavaScript happens inside the execution context</p><p>Confused? Well don’t worry let us see how execution context looks like</p><p>The execution context is like a big box which has 2 components</p><p>The first component is known as memory component , in this component all the variables and function are stored in <strong>key value</strong> pair</p><p>This memory component is also known as variable environment</p><p>Now, the second component of this execution context is code component, in this component the code is executed one by one</p><p>The code component is also known as Thread of execution</p><p>Thread of execution is nothing but its like a thread where the code is executed one by one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ze8CJ2CM6o5v6F4n_OrY7w.jpeg" /></figure><p>Now remember the first line that i wrote?</p><p>That is JavaScript is a Single threaded , Synchronous language , but what does this means?</p><p>Let us see</p><p>When i say that JavaScript is a single threaded synchronous language it means that it executes one command at a time and in specific order.</p><p>JavaScript is nothing without this execution context</p><p>Now let us take a look at how exactly JavaScript code runs?</p><p>Let us take an simple example</p><pre>var a = 4;<br>function cude(num)<br>{<br>		var result = num*num*num;<br>		return result;<br>}<br>var cude1 = cube(a);<br>var cubea = cube(5);</pre><p>Now we all know what this code is going to give us.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F788447%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F788447%2F&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/18214d8333adbb5668f31791a3202b60/href">https://medium.com/media/18214d8333adbb5668f31791a3202b60/href</a></iframe><p>But when i write this code what exactly is happening behind the scenes in JavaScript engine ,let us see</p><p>When you execute this code the global execution code is created</p><p>So when the global execution phase is created it is created in 2 phases that is</p><ol><li>Memory creation phase</li><li>Code execution phase</li></ol><p><strong>Memory creation phase</strong></p><p>Take a look at out above JS code, so when JS sees that variable a is defined , a particular memory is allocated to it in this phase</p><p>Now, most important thing is that if the memory is allocated to the variable a then what value it stores , it stores a special value that is <strong>UNDEFINED.</strong></p><p>Then after that JS will go to line 2 where we have defined a function cube and allocate a specific memory to it.</p><p>For the function the whole code inside the function is stored in this phase</p><p>Then it will also allocate a memory to our variable cube1 and cubea , again as it another variable it will allocate a special value to it that is UNDEFINED.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVF7hNowf8KoSr8ifl6IlA.jpeg" /><figcaption>Memory allocation phase</figcaption></figure><p><strong>Code execution phase</strong></p><p>After the memory allocation phase, JavaScript once again runs through the whole code line by line and executes the code now</p><p>In this phase all the calculations and function is done</p><p>As it sees that the value that is given to variable a in code is 2 , it will place 2 inside the variable a in memory allocation phase overriding our special value undefined</p><p>Now in this phase we are going to invoke our function</p><p>As the function is going to invoke, here a whole new execution context is going to be created.</p><p>Now its turning interesting</p><p>Now again it will go through 2 phases memory creation and code execution phase</p><p>Inside that memory creation phase we will allocate memory to 2 variables they are num and result and give them special value that is undefined</p><p>And inside code execution phase the value of n is passed to variable num as we have passed it as an argument.</p><p>And then all the calculation is done in this phase that is num is calculated inside this phase and the result is store into the result variable inside memory allocation phase overriding our undefined value so the result variable will store value 64 .</p><p>Then it will go to another line where we have return the value result , return basically says that the work is over and hand over all the result again to the execution context where the function was invoked</p><p>No as soon as we return result it will find a the value of result into memory allocation phase that is 64 and return that value to the phase where we have allocated variables cube1</p><p>Confused? Let us understand through a diagram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CW7jFSWImu2jx16GQL9N6g.jpeg" /><figcaption>Code execution phase</figcaption></figure><p>Now after the return is executed the whole execution context inside our code execution phase gets deleted</p><p>And now it moves to next line</p><p>As in last line we have invoked the function it will again follow the same process and change our cubea variable value to 125.</p><p>And after function is executed that whole execution phase will get deleted</p><p>And at last our whole and main execution context will also get deleted…….</p><p>Hey! Thankyou for reading the blog, i hope you gained some insights on JavaScript</p><p>Do follow and comment to get such amazing blogs about JavaScript, and do watch akshaysaini namaste JavaScript playlist on YouTube.</p><p>If there is anything wrong you found in this blocg then feel free to add a comment!</p><p>Thankyou..signing of…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df44f9dd1c42" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/javascript-behind-the-scenes-df44f9dd1c42">JavaScript — Behind the scenes</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[undefined vs not defined in JavaScript]]></title>
            <link>https://medium.com/front-end-weekly/undefined-vs-not-defined-in-javascript-8f4b41aeca54?source=rss-4e2e2805efe------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f4b41aeca54</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Shubhvrat kulkarni]]></dc:creator>
            <pubDate>Mon, 05 Feb 2024 16:36:58 GMT</pubDate>
            <atom:updated>2024-07-19T15:32:51.036Z</atom:updated>
            <content:encoded><![CDATA[<h4>undefined and not defined are 2 different concepts let us go more deeper</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JxGh6Cgy4NlTd_sb" /><figcaption>Photo by <a href="https://unsplash.com/@tracycodes?utm_source=medium&amp;utm_medium=referral">Tracy Adams</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hey readers,</p><p>JavaScript is the most loved language in the world, but beginners often make mistake of starting without learning some important and basic concepts of JavaScript, but don’t worry we will learn some of the concept here</p><p>Let us start!!</p><h4><strong>Undefined vs Not-defined</strong></h4><p>Most of the people think that Undefined is similar as not-defined.</p><p><strong>NO</strong> , they both are totally different concept, lets learn them for better understanding</p><h4><strong>Undefined</strong></h4><p>There is a statement for JavaScript — <strong>Every thing happens in JavaScript happens inside execution context.</strong></p><p>And execution context has two phases <strong>memory allocation phase</strong> and <strong>code execution phase</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F788447%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F788447%2F&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/18214d8333adbb5668f31791a3202b60/href">https://medium.com/media/18214d8333adbb5668f31791a3202b60/href</a></iframe><p>When, we declare a variable, in execution context a memory is allocated to that variable.</p><p>confused? Lets see an example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*r7wJulNVRryNh3PkTgdCJQ.png" /><figcaption>code example</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/187/1*PleNCVS9VXgv0pehRAEgXA.png" /><figcaption>output</figcaption></figure><p>Now, in above code I have declared a variable.</p><p>In memory allocation phase, <strong>var a</strong> will be allocated a memory and it will be assigned a special value that is <strong>undefined</strong></p><p>So, <strong>undefined is a special value that is allocated to variable during memory allocation phase.</strong></p><h4><strong>Not-defined</strong></h4><p>Now, when we declare a variable it is allocated a memory in <strong>memory allocation phase, but </strong>when you try to log a variable that has not allocated a memory or in simple words you have not declared that variable in your code then it will throw us an error. for example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*8HXptAAIK_b8udOxX2Dm2Q.png" /><figcaption>code</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*mtQqGFvLSc9YTioOpJKv8g.png" /><figcaption>output</figcaption></figure><p>So, in above code i have declared var a and will be allocated a memory. But when i want an output of a variable that is not defined in the code, it will give us error that is —</p><p><strong>Uncaught ReferenceError : b is not defined .</strong></p><p>this is what <strong>not defined</strong> is.</p><p><strong>Let us summarize</strong></p><p><strong>Undefined</strong> is a special value that is assigned to a variable.</p><p><strong>Not defined</strong> is an error which arises when we try to console.log a variable which is not declared in code or have not allocated any memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*TKIajySm1cKR4gvT4eS3PQ.png" /><figcaption>code</figcaption></figure><p>So, in above code you can see that we have accessed <strong>var a</strong> before initializing it, what output it will give us?? 🤔</p><p>Yes you are right 👍, it will show us our special value that is <strong>undefined</strong> in the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*qUWGvl4P3cMJDdl6iruV8Q.png" /><figcaption>code</figcaption></figure><p>But that is in the case of <strong>var</strong>, but what about <strong>let</strong>? Will it give us the same output as above?? 🤔</p><p>What do you think?</p><p>Now here is a tricky part</p><p>According to what we have learnt above the above program should give us output <strong>undefined</strong> right.!</p><p>NO, this will throw us an error which says —</p><p><strong>Uncaught ReferenceError : Cannot access ‘b’ before initialization</strong></p><p>What is the reason behind this error?</p><p>Let us go deeper into it.</p><p>Let us first understand the error, the error is telling us that you could not access b before initializing it or giving it a value.</p><h4><strong>case</strong></h4><p><strong>case </strong>— it will not throw is any error because we haven’t accessed <strong>‘b’</strong> after initializing it.</p><p>Now, if you enable a debugger even before a single line of code you will see some magic</p><p>what exactly will you see?</p><p>Even before debugging single line of code we will see in scope JavaScript have allocated our <strong>b</strong> a memory and assigned it a special value undefined in <strong>script,</strong> similarly to our variable <strong>a</strong> JavaScript has allocated a memory and assigned undefined in <strong>Global</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*Svi4OkCuhoNxEz6hsI44fA.jpeg" /></figure><p>In above image you can see in case of our it is in the Global space while for let it is in Script.</p><p>Strange!!</p><p>This happened because, <strong>a</strong> has been allocated a memory to the var declaration and that <strong>a</strong> gets attached to the global object</p><p>In the case of let and const memory gets allocated but they are stored in different memory space other than global, and you cannot access this memory space unless you put some value to it.</p><p>JavaScript language is full of Surprises!!</p><p><strong>Thankyou for reading. I hope it was helpful.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f4b41aeca54" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/undefined-vs-not-defined-in-javascript-8f4b41aeca54">undefined vs not defined in JavaScript</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make your JavaScript code better…..]]></title>
            <link>https://javascript.plainenglish.io/make-your-javascript-code-better-9ef4f5136378?source=rss-4e2e2805efe------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ef4f5136378</guid>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shubhvrat kulkarni]]></dc:creator>
            <pubDate>Thu, 14 Apr 2022 06:05:21 GMT</pubDate>
            <atom:updated>2024-07-18T02:55:16.069Z</atom:updated>
            <content:encoded><![CDATA[<h3>Convert many lines of code into one line in JavaScript</h3><h4>Make you JavaScript code more efficient</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dWbUPRpLvTO7RtM6" /><figcaption>Photo by <a href="https://unsplash.com/@sapegin?utm_source=medium&amp;utm_medium=referral">Artem Sapegin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Writing code is one aspect but writing code efficiently is really very important. So let us try making our code more efficient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*OWLf0PPSq02mLoTmlBLdRA.jpeg" /><figcaption>code</figcaption></figure><p>In above code as you can see i have defined a function square with arr as parameter then i have defined an empty array resultArr then i have for looped till i &lt; arr.length, so until its equal to length of my array add square of elements to resultArr.</p><p>Now lets simplfy our code……</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*v7rmq5Pv5VmU1P_lE7cWkA.jpeg" /><figcaption>code</figcaption></figure><p>In above code we have simplified our code a bit we have used<strong> for of </strong>which will iterate through every elements in array, and instead of writing arr[i]*arr[i] we have just written it i*i.</p><p>Lets simplify it more….</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*LAC-7cetkHFJ9FCk6_4I9w.jpeg" /><figcaption>code</figcaption></figure><p>Now we have simplified more we have defined map function now what map function does? It will iterate through every element of array then it will perform a function for every element and return an array containing all the values.</p><p>You thought that’s it? No, we can simplify it more…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*ag_jG5kZ20KmJux5WC7wvw.jpeg" /><figcaption>code</figcaption></figure><p>In JavaScript you can define a function in 2 ways either function square(arr) or square = (arr)=&gt;. But here second one looks more nice. So in above code i have converted my function square4(arr) to square4 = (arr) =&gt;.</p><p>And you can see the difference above code looks nice.</p><p>Okay! Lets simplify it more..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*CPD5JEb8Baxn85v9x02Cng.jpeg" /><figcaption>code</figcaption></figure><p>Instead of returning my map function i can simply write it without using return as you can see above</p><p>Woaah! Let simplify it last time..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*5GwJA4ycZp-0K35WqhZTKA.jpeg" /><figcaption>code</figcaption></figure><p>So as you know inside my map function i have defined a function called element so instead of writing it like function(element) i can write it like element =&gt; and also instead of using return element*element i can simply write it like element*element.</p><h4>conclusion</h4><p>So we have converted our 5 lines of code into 1 line, isn’t that great?, this is the beauty of JavaScript.</p><p>Thankyou for reading. I hope it was useful.</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ef4f5136378" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/make-your-javascript-code-better-9ef4f5136378">Make your JavaScript code better…..</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>