<?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>Forem: Moreshwar Pidadi</title>
    <description>The latest articles on Forem by Moreshwar Pidadi (@moreshwar).</description>
    <link>https://forem.com/moreshwar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F566013%2Fe1277400-c1df-492c-93bb-f56e63c6d3f2.jpg</url>
      <title>Forem: Moreshwar Pidadi</title>
      <link>https://forem.com/moreshwar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/moreshwar"/>
    <language>en</language>
    <item>
      <title>Server, Web Server &amp; HTML</title>
      <dc:creator>Moreshwar Pidadi</dc:creator>
      <pubDate>Sun, 06 Nov 2022 04:30:00 +0000</pubDate>
      <link>https://forem.com/moreshwar/server-web-server-html-3a39</link>
      <guid>https://forem.com/moreshwar/server-web-server-html-3a39</guid>
      <description>&lt;h2&gt;
  
  
  What is a Server?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Program that provides the service to the other computers.&lt;br&gt;
In this case the other computers can be also called as clients. And the term &lt;strong&gt;servers&lt;/strong&gt; is being referred to where the request is being  received for web file and being sent back to client.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;As they are constantly providing the service they can't be shut down else there would be service interruption.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Below are some  the examples for servers &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Application server
2. Blade server
3. Cloud server
4. Database server
5. Dedicated server
6. Domain name service
7. File server
8. Mail server
9. Print server
10. Proxy server
11. Standalone server
12. Web server 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Web Server
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;The term web server refers to both hardware or software or both working together.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are 2 type of web servers&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Static web server (Server the static sites) and 2. Dynamic webserver (Server the dynamic sites).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All the communication takes place with the help of protocols which are nothing but the set of instructions. &lt;/p&gt;
&lt;h2&gt;
  
  
  HTML Tags
&lt;/h2&gt;

&lt;p&gt;There are total 6 levels of heading from H1 to H6.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Heading level 1&amp;lt;/h1&amp;gt;
&amp;lt;h2&amp;gt;Heading level 2&amp;lt;/h2&amp;gt;
&amp;lt;h3&amp;gt;Heading level 3&amp;lt;/h3&amp;gt;
&amp;lt;h4&amp;gt;Heading level 4&amp;lt;/h4&amp;gt;
&amp;lt;h5&amp;gt;Heading level 5&amp;lt;/h5&amp;gt;
&amp;lt;h6&amp;gt;Heading level 6&amp;lt;/h6&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However because of accessibility concern we should not skip the sequencing of these tags.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not Recommended
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Heading level 1&amp;lt;/h1&amp;gt;
&amp;lt;h3&amp;gt;Heading level 3&amp;lt;/h3&amp;gt;
&amp;lt;h4&amp;gt;Heading level 4&amp;lt;/h4&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Recommended
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Heading level 1&amp;lt;/h1&amp;gt;
&amp;lt;h2&amp;gt;Heading level 2&amp;lt;/h2&amp;gt;
&amp;lt;h3&amp;gt;Heading level 3&amp;lt;/h3&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Anchor element
&lt;/h2&gt;

&lt;p&gt;Syntax:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;&amp;lt;a href="destination_url"&amp;gt;label&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This element or tag creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This element has a attributes, download, href, hreflang, ping, referrerpolicy, rel, target, type.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;To link the phone number&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;a href="tel:+91 125466555"&amp;gt;Call Us&amp;lt;/a&amp;gt;"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;o/p: &lt;a href="tel:+91%20125466555"&gt;Call Us&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To link email&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;a href="mailto:test@gmail.com"&amp;gt;Email&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;o/p: &lt;a href="mailto:test@gmail.com"&gt;Email&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can also enclosed the

&lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt;

tag withing other tags/elements like

&lt;code&gt;&amp;lt;p&amp;gt;, &amp;lt;strong&amp;gt;&lt;/code&gt;

etc. and some tags within it as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;And we use &lt;strong&gt;target&lt;/strong&gt; attribute to open the links in new tab.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;code&gt;&amp;lt;a target="_blank" href="https://www.test.com"&amp;gt;Test&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;This will open the link in the new tab.&lt;/p&gt;

</description>
      <category>html</category>
      <category>servers</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>SETs and MAPs in JS.</title>
      <dc:creator>Moreshwar Pidadi</dc:creator>
      <pubDate>Sun, 13 Mar 2022 03:07:40 +0000</pubDate>
      <link>https://forem.com/moreshwar/sets-and-maps-in-js-17da</link>
      <guid>https://forem.com/moreshwar/sets-and-maps-in-js-17da</guid>
      <description>&lt;h2&gt;
  
  
  SETs
&lt;/h2&gt;

&lt;p&gt;In JavaScript untile now we have used or quite familer with the &lt;strong&gt;ARRAYs&lt;/strong&gt; and &lt;strong&gt;OBJECTs&lt;/strong&gt; but in addition to it we have 2 more data structure in JS i.e &lt;strong&gt;SETs&lt;/strong&gt; and amd &lt;strong&gt;MAPs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.  SETS&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sets stores the unique values i.e it may be premitive values and object references.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When we say Unique Value that means there is no duplication of values get's added in collections.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H3Eimk_9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6xoix0f9upx2oyh7geff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H3Eimk_9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6xoix0f9upx2oyh7geff.png" alt="Image description" width="880" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sets looks similar to array, also there are no &lt;strong&gt;key&lt;/strong&gt; &amp;amp; &lt;strong&gt;value&lt;/strong&gt; pair, so basically it the bunche of value clubed togeather.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Just like arrays sets are also &lt;strong&gt;itterables&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As the values stored in sets are &lt;strong&gt;unique&lt;/strong&gt; the sets are different from arrays.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Here are a few properties and methods which are used to explore this data structure in detail which are as follows&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SIZE&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To find out the size/length of the sets collections.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const test = new Set("Moreshwar");
console.log(test.size);
// 8 as the 'r' is duplicated and hence its been excluded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;has()&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To check if set has certain "value" in it collections, whoever the o/p is &lt;strong&gt;true&lt;/strong&gt; or &lt;strong&gt;false&lt;/strong&gt; boolean.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;add()&lt;/strong&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To add the value in set collection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;delete()&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In order to delete the value from the set.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;**Note**: Once we use _add()_ and _delete()_ methods the size of every sets i.e collections gests updated.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W7-bvwyH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lp0obs4e4tnl30o2a32p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W7-bvwyH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lp0obs4e4tnl30o2a32p.png" alt="Image description" width="880" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Sets are itterables and hence they can be loop over and we can use for of loop for the same.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As the ARRAY and SETs both are itterables conversion from array to set is quite comfortable &lt;strong&gt;(...) spread operator will work on all itterables&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yAjxyn48--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uielnbx19zz2rnb8tmdm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yAjxyn48--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uielnbx19zz2rnb8tmdm.png" alt="Image description" width="880" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Howerver, sets are not intended to replace an Arrays, Incase if you have to store the value which will consist of duplicate we will go for array.&lt;/p&gt;

&lt;h2&gt;
  
  
  MAPs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Just like an &lt;strong&gt;Object&lt;/strong&gt;, data is stored in &lt;strong&gt;KEY &amp;amp; VALUE&lt;/strong&gt; pair in the MAPs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;However the only difference is the &lt;strong&gt;KEYs&lt;/strong&gt; in Map's can have different type's(i.e nubmber, string, Array, Other Maps etc ).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Objects teh key is always a &lt;strong&gt;string&lt;/strong&gt; and in Maps there can be any type of key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Following are some methods to handle Map Data Structure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Set()&lt;/strong&gt; =&amp;gt; To add the data into the Maps collections.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can also set the chain scope for adding data into Map's collections.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By giving a call to the SET() methods gives us and updated maps and hence we can call SET() again on the same hence we can do chain scoping.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;get()&lt;/strong&gt; =&amp;gt; To get the value from the maps with the help of KEYS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;has()&lt;/strong&gt; =&amp;gt; To check if the Map Collection &lt;strong&gt;has&lt;/strong&gt; a certain keys or not. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;delete()&lt;/strong&gt; =&amp;gt; To &lt;strong&gt;delete&lt;/strong&gt; the value form the Maps collections with the help of &lt;strong&gt;KEY&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;size()&lt;/strong&gt; =&amp;gt; To calculate the &lt;strong&gt;size/length&lt;/strong&gt; of the Maps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;clear()&lt;/strong&gt; =&amp;gt; To &lt;strong&gt;remove&lt;/strong&gt; all the elements form the map also can delete the value based on &lt;strong&gt;KEY&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_NaevEV6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhdaclfrbs4rnha2x31g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_NaevEV6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhdaclfrbs4rnha2x31g.png" alt="Image description" width="880" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Maps too are &lt;strong&gt;itterables&lt;/strong&gt; hence we can use the loop for the same.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maps can be converted to ARRAYs by using &lt;strong&gt;(...)spread operators&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--68FJXB2q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4q1quzdmv8sh1x0a0aep.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--68FJXB2q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4q1quzdmv8sh1x0a0aep.png" alt="Image description" width="880" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Strings in JS</title>
      <dc:creator>Moreshwar Pidadi</dc:creator>
      <pubDate>Sat, 05 Mar 2022 20:42:17 +0000</pubDate>
      <link>https://forem.com/moreshwar/strings-in-js-nnk</link>
      <guid>https://forem.com/moreshwar/strings-in-js-nnk</guid>
      <description>&lt;p&gt;The string object is used to represent and manipulate the character.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: that JavaScript distinguishes between &lt;strong&gt;String objects&lt;/strong&gt; and primitive &lt;strong&gt;String values&lt;/strong&gt;.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;String literals&lt;/strong&gt; (denoted by &lt;em&gt;double&lt;/em&gt; ("Moreshwar") or &lt;em&gt;single&lt;/em&gt; ('Moreshwar') quotes).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Strings returned from String calls in a &lt;strong&gt;non-constructor context&lt;/strong&gt; (that is, called without using the &lt;strong&gt;new keyword&lt;/strong&gt;) are &lt;strong&gt;primitive&lt;/strong&gt; strings. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JavaScript &lt;strong&gt;automatically converts primitives to String objects&lt;/strong&gt;, so that it's possible to use String object methods for primitive strings. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In contexts where a method is to be invoked on a primitive string or a property lookup occurs, &lt;strong&gt;JavaScript will automatically wrap the string primitive and call the method or perform the property lookup.property lookup&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some of the useful methods for strings are as follow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. string.length()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const firstName = "Moreshwar";

console.log(firstName.length); // o/p: 9

console.log("Moreshwar".length); // o/p: 9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Behind the sceen the method is been call'ed (i.e &lt;em&gt;&lt;strong&gt;PREMITIVE&lt;/strong&gt;&lt;/em&gt; Strings).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JS will automatically convert existing &lt;strong&gt;String&lt;/strong&gt; to &lt;strong&gt;String Object&lt;/strong&gt; with same content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hence, above example would be like &lt;strong&gt;new String("Moreshwar")&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. string.slice(BeginParamater,EndParameter)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;console.log(airline.slice(2, 5));&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creates substring, if we do not specify the ENDSTRING everything will be extracted.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(firstName.slice(2, 5)); // o/p: res 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("123456789".slice(-4)); // o/p: 6789
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. string.split("parameter")&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;split()&lt;/code&gt;method divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Ex.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Moreshwar".split());
console.log("CODE + DAILY".split("+")); // ['CODE','DAILY']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. string.join("parameter")&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;join()&lt;/code&gt; method creates and returns a new string by concatenating all of the elements in an array (or an array-like object), separated by commas or a specified separator string.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Ex.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name = ["Mr.".toUpperCase(), "Moreshwar" ,"Pidadi"];
console.log(name.join()); // MR. Moreshwar Pidadi 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. string.padStart(targetLength, padString)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;padStart()&lt;/code&gt;method pads the current string with another string (multiple times, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;padEnd()&lt;/code&gt; method pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end of the current string.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const message = "Hello every one this is string 
method padStart() and padEnd()";
console.log(message.padStart(0, "*"));
console.log(message.padStart(50, "*").padEnd(35, "#"));

o/p:

****Hello every one this is string method padStart() and padEnd()
***Hello every one this is string method padStart() and padEnd()######
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. string.repeat(number)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;repeat()&lt;/code&gt; method constructs and returns a new string which contains the specified number of copies of the string on which it was called, concatenated together.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Moreshwar".repeat(5));

o/p: 
     Moreshwar
     Moreshwar
     Moreshwar
     Moreshwar
     Moreshwar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>programming</category>
      <category>codenewbie</category>
      <category>strings</category>
    </item>
    <item>
      <title>this keyword in JS</title>
      <dc:creator>Moreshwar Pidadi</dc:creator>
      <pubDate>Fri, 04 Feb 2022 22:35:07 +0000</pubDate>
      <link>https://forem.com/moreshwar/this-keyword-in-js-2kol</link>
      <guid>https://forem.com/moreshwar/this-keyword-in-js-2kol</guid>
      <description>&lt;p&gt;As we know &lt;strong&gt;Execution Context (EC)&lt;/strong&gt; consist of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Varaiable Enviornment&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scope Chain&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;this&lt;/strong&gt; keyword&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So lets explore this keyword more.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;"&lt;strong&gt;this&lt;/strong&gt;" &lt;em&gt;keyword&lt;/em&gt;/&lt;em&gt;variable&lt;/em&gt; in JS.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;this&lt;/em&gt; is special variable that is created for every &lt;em&gt;&lt;strong&gt;Execution Context (EC)&lt;/strong&gt;&lt;/em&gt; i.e for every function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;this&lt;/em&gt; takes value of (or points to) the owner of the function in whcih the "&lt;em&gt;this&lt;/em&gt;" keyword is used.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remember &lt;em&gt;"this"&lt;/em&gt; is not static it depends on how the function is called, and it's value is only assigned when the function is actually called.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As we know the function can be called in 4 different ways &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a. method =&amp;gt; this = &amp;lt;&lt;em&gt;object that is calling the method&lt;/em&gt;&amp;gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ex:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qPoDrjQw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmlgrogilyvhwhuejn9e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qPoDrjQw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pmlgrogilyvhwhuejn9e.png" alt="Image description" width="775" height="364"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Call to the function moreshwar.calcAge();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The value of _*&lt;em&gt;this *&lt;/em&gt;_should / is &lt;code&gt;moreshwar&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;As we can say now that &lt;em&gt;this&lt;/em&gt; is object giving call to method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So, using &lt;em&gt;this&lt;/em&gt; we can now access the properties of an  object. Accessing the properties using (&lt;em&gt;this&lt;/em&gt;) is a way better solution.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;b. Simple function call: where this = undefined&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Note: its is valid only for strict mode
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ex. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ITtjEjPD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxzgfc3015qe9m4ihorx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ITtjEjPD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxzgfc3015qe9m4ihorx.png" alt="Image description" width="588" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If not strict mode &lt;em&gt;this&lt;/em&gt; will point to Global object / Windows object. Which can then be more problamatic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This is reason we should always be useing &lt;strong&gt;strict mode&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;c. Function call using Arrow function&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;i.e ArrowFunctionName =&amp;gt;  = &amp;lt;&lt;em&gt;this of sorounding function (lexical this)&lt;/em&gt;&amp;gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Arrow function it does not get the "&lt;em&gt;this keyword&lt;/em&gt;".&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h3skB22r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/modj89msimu9nnjey2h1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h3skB22r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/modj89msimu9nnjey2h1.png" alt="Image description" width="880" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;d.&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;EventListner =&amp;gt; this = &amp;lt;DOM elements that handler is attachedto&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Hence, this will never points to the function, where we are using it, it would point to the object (parent object).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also "&lt;em&gt;this&lt;/em&gt;" keyword will never point to the variable enviornment of the function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"&lt;em&gt;this&lt;/em&gt;" keyword in Global Scope is always &lt;strong&gt;Windows&lt;/strong&gt; Object, which make &lt;strong&gt;&lt;em&gt;this keyword dynamic&lt;/em&gt;&lt;/strong&gt; not static.  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
      <category>this</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Execution of JS Code 🧑‍💻👨‍💻</title>
      <dc:creator>Moreshwar Pidadi</dc:creator>
      <pubDate>Sat, 15 Jan 2022 09:09:45 +0000</pubDate>
      <link>https://forem.com/moreshwar/execution-of-js-code-im2</link>
      <guid>https://forem.com/moreshwar/execution-of-js-code-im2</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Let's assume our code has just been complied, post compliation the &lt;strong&gt;&lt;em&gt;Global Execution Context(GEC)&lt;/em&gt;&lt;/strong&gt; is created. There can be only one &lt;em&gt;&lt;strong&gt;GEC&lt;/strong&gt;&lt;/em&gt; irrespective the size of JS project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HkGBslSt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fmoksr90lffgsbf8kucj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HkGBslSt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fmoksr90lffgsbf8kucj.png" alt="Image description" width="281" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Inside the Gclobal Execution Context(GEC), the top level code is been executed (i.e Code which is out side the function is executed).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This includes variable decleration, functions which are decleared etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But remember the code inside the function is &lt;strong&gt;NOT&lt;/strong&gt; been executed, it shall be executed only when the function is been &lt;strong&gt;call&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Here 1st we should find out What is Gobal Execution context/ Execution Context and how is it important.
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Enviornment where the piece of code JS Code is executed such as loal variables, arguments passed in etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In short the JS Code always run inside the Execution Context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As there can be always one &lt;strong&gt;&lt;em&gt;GEC&lt;/em&gt;&lt;/strong&gt; , there is an default context where the code is executed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For every function call there is &lt;strong&gt;&lt;em&gt;new execution context&lt;/em&gt;&lt;/strong&gt; is created. Which contains all the necessary information required to excute the funcion.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the Top level code is finished the top level code is executed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  What is Inside the &lt;em&gt;Execution Context&lt;/em&gt;?
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Variable Enviorement&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;let, const, var, Decleration.&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Aurgments Object (All function arguments that current execution context belong to).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;The Function get's its execution context as soon as its been call&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So all the variables decleared inside the function shall be executed, and these can also be accessed outside the function.&lt;/li&gt;
&lt;li&gt;This is possible because of the &lt;strong&gt;Scope Chain&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scope Chain&lt;/strong&gt; are the references to the variable loated outside the function. &lt;/li&gt;
&lt;li&gt;And to keep track of each function it is been stored in &lt;strong&gt;Execution Context&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Each Execution Context gets &lt;em&gt;this&lt;/em&gt; keyword&lt;/strong&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So inside the execution context 

&lt;ol&gt;
&lt;li&gt;Variable Enviornment &lt;/li&gt;
&lt;li&gt;Scope Chain&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;this&lt;/em&gt; keyword&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;em&gt;Note&lt;/em&gt;: Arrow function &lt;strong&gt;do not&lt;/strong&gt; get &lt;strong&gt;this&lt;/strong&gt; keyword and argument object insted they can if required use it from the closest parent function.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SWxbIi5n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g77evi23tj8r1xtgxqh4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SWxbIi5n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g77evi23tj8r1xtgxqh4.png" alt="Image description" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Here &lt;strong&gt;call Stack&lt;/strong&gt; comes into picture, Call stack is the place where execution context gets stacked on the top of each other to keep the tarck of where we are in the execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H5FWQ1U6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dvu3yvo41ysw6q03n7gx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H5FWQ1U6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dvu3yvo41ysw6q03n7gx.png" alt="Image description" width="761" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Once this is completed it would be removed from stack and control should be passed on to &lt;strong&gt;Previous Execution Context&lt;/strong&gt; return statment from the function will indicate current execution context shall be &lt;strong&gt;poped&lt;/strong&gt; out of the call stack.    &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And thus return statement plays and important role in givinig call to the previous execution context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the end Global execution shall be executed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Program will remian in state as is until its finished (i.e Browser window is closed.)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WBcdIVZo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lroph0hy3qujbcbv35wr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WBcdIVZo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lroph0hy3qujbcbv35wr.png" alt="Image description" width="880" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;
Moreshwar P&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>execution</category>
      <category>executioncontext</category>
    </item>
    <item>
      <title>Modern JS Engine Workflow</title>
      <dc:creator>Moreshwar Pidadi</dc:creator>
      <pubDate>Sat, 08 Jan 2022 21:22:16 +0000</pubDate>
      <link>https://forem.com/moreshwar/modern-js-engine-workflow-35g5</link>
      <guid>https://forem.com/moreshwar/modern-js-engine-workflow-35g5</guid>
      <description>&lt;p&gt;&lt;strong&gt;JS Engine is a program that executes the JS code, every browser has its own JS Engine following are some of the examples.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chrome -  V8 &lt;/li&gt;
&lt;li&gt;Edge - Chakra&lt;/li&gt;
&lt;li&gt;Safari - Nitro&lt;/li&gt;
&lt;li&gt;Firefox - Spider Monkey&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F2lfzsje0v0vaukvkh3c0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2lfzsje0v0vaukvkh3c0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How does the code get compiled to machine code?
&lt;/h2&gt;

&lt;p&gt;But before that, we need to know the difference between &lt;strong&gt;&lt;em&gt;compilation&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Interpretation&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compilation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The entire Source code is converted into machine code at once and written to a binary file 0's and 1's which can be executed later processor.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fcf8g9954pnhlk1t79y41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fcf8g9954pnhlk1t79y41.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Source Code gets Complied and covert the portable file (machine code) and then its portable files get executed and we are now able to run the program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's a 2 step process 1. compilation and 2. Execution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always remember the execution would take place after compilation only.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For Ex. whatever files or programs you are now executing are already complied with are ready to be executed as you are just hitting the trigger to execute them.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Interpretation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The interpreter Runs through the source code and executes it line-by-line.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fgaljwmtb3o08b9wtgpdz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fgaljwmtb3o08b9wtgpdz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;JS initially used to be interpreted language, and the problem with interpreted language is they are much slower.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Whereas in modern JS, low/slow performance is not at all acceptable, However, modern JS Engine, now uses a mix of both i.e Compilation and interpretation this is called Just-in-time compilation.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Just in time compilation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The entire Source code is converted into machine code, at once then executed immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdmw2x1gpz43jcmwintai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdmw2x1gpz43jcmwintai.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;And here no portable file is created, hence code is executed immediately, which is a lot faster than executing the code line-by-line. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Where Source code is parsed and then converted into Abstract Syntax Tree (AST), this is very different from the DOM tree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, here is the splitting of each line of code meaningful language.  Ex: const, let, function, etc. Keywords&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This piece of code is then saved into the tree in a structured way.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It also checks if there is only a syntax error. This tree then shall be used to machine code. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Following is a flow-chart for the Just-in-time compilation:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdaxcgx688ceq1isaleel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdaxcgx688ceq1isaleel.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;However modern JS Engine uses very clever optimization, strategies.&lt;/li&gt;
&lt;li&gt;Like they create a very unoptimized version of machine code, in the beginning, just so that they can start executing the code as fast as possible.
&lt;/li&gt;
&lt;li&gt;In the Background, this code is optimized and re-complied in already/ongoing running execution, this can be done multiple times without ever stopping the execution.&lt;/li&gt;
&lt;li&gt;This process makes modern  JS fast, all this parsing, compilation, execution, Optimization happens in some thread inside JS Engine,  which can be accessed from our source code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fpupzvq39i63cajfibpnv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpupzvq39i63cajfibpnv.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By: Moreshwar P&lt;/p&gt;

</description>
      <category>jsengine</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
