<?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: Ibrahim Elhofy</title>
    <description>The latest articles on Forem by Ibrahim Elhofy (@ibrahim-elhofy).</description>
    <link>https://forem.com/ibrahim-elhofy</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%2F340527%2Fe3f02b4d-1a04-4def-8fe3-414251c3a914.png</url>
      <title>Forem: Ibrahim Elhofy</title>
      <link>https://forem.com/ibrahim-elhofy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ibrahim-elhofy"/>
    <language>en</language>
    <item>
      <title>A brief overview of what alt data is ?</title>
      <dc:creator>Ibrahim Elhofy</dc:creator>
      <pubDate>Wed, 16 Nov 2022 04:36:13 +0000</pubDate>
      <link>https://forem.com/ibrahim-elhofy/a-brief-overview-of-what-alt-data-is--511j</link>
      <guid>https://forem.com/ibrahim-elhofy/a-brief-overview-of-what-alt-data-is--511j</guid>
      <description>&lt;p&gt;You must know enough about the company or the sector you will invest in to make accurate investment decisions. You can gather this information from formal reports such as company filings, broker forecasts, and management guidance but this will not give you the full picture. The more data outside the conventional you have, the easier it will be to decide your next investment, leaving little to gut feelings.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Alternative Data?
&lt;/h1&gt;

&lt;p&gt;The key to solving the problem is using alternative data, which can be any non-traditional data that can provide information on how well a company or asset will perform in the future. And don't worry there is an abundance of this kind of data thanks to the devices we use. However, the question remains: what are the most effective ways to harvest and utilize it?&lt;/p&gt;

&lt;h1&gt;
  
  
  Where can I harvest this data from?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Social media
&lt;/h2&gt;

&lt;p&gt;It provides a lot of data that really represents people's behaviors and how they behave as humans. these data like social media activity, online reviews, and web searches. Engagements of fans and followers count on a brand’s page can indicate future receptiveness when it launches new products or new campaigns and can be used for Event-driven sentiment tracking or Brand Virality/Advertising success.&lt;/p&gt;

&lt;h2&gt;
  
  
  Web browsing
&lt;/h2&gt;

&lt;p&gt;Does a software company's app attract or drop new users? Are sites in a particular product category experiencing a sudden influx of visitors? Is the company suffering from weakness and despair and suddenly giving a huge discount?&lt;br&gt;
With an ocean of 4 billion web pages, there is a lot of valuable data for investors, which makes investors able to answer questions like ours. This data can be high product ratings that can indicate strong sales and give a positive insight into a manufacturer or company, Traffic data that can indicate a company's ability to attract new users, quantity sold, and prices on each item page and more of these data&lt;br&gt;
Mobile application data&lt;br&gt;
Like social media, mobile application data reveals a lot of subtle behaviors around the consumer that are very real and close to the market along with in-app activities that can make us know more about how the market works and give us an understanding of the consumer demographic. The level of accuracy and usefulness of the data depends on the size of the application panel and the functions and features collected&lt;/p&gt;

&lt;h2&gt;
  
  
  Email recipes
&lt;/h2&gt;

&lt;p&gt;Transaction data that is generated from email receipts are accurate enough to build a prediction model about consumers' purchase behaviors, but panels are typically smaller than credit/debit card panels and can be biased depending on the nature of the email receipt collection still you can be given an insight about how macroeconomic conditions like inflation impact demand and purchase&lt;/p&gt;

&lt;h2&gt;
  
  
  Location data
&lt;/h2&gt;

&lt;p&gt;Where people go is valuable information. More specifically, the GPS data they test on their phones over cellular networks, which reveals broader consumer traffic trends, is valuable information that gives us insight into subtle directions that web or social media searches don't reveal. Social. And that became even more true during the pandemic. In the past, geolocation was not considered quite as useful as other alternative sensor-based data streams, such as satellite imagery. But when previously predictable traffic patterns break down, Wall Street's appetite for GPS seems to be expanding.&lt;/p&gt;

&lt;h2&gt;
  
  
  People &amp;amp; Company data
&lt;/h2&gt;

&lt;p&gt;This data can give an insight into the next destination of CEOs of the companies like FAANG - be it another company, competitor, or if they are starting a company.&lt;br&gt;
Companies like Proxycurl provide data on identifying and tracking prospective founders. Using the Employee Listing and Person Profile API endpoints, hedge funds can identify existing employees of FAANG companies, then track their change of jobs history all in one place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Jet tracking
&lt;/h2&gt;

&lt;p&gt;When a private jet carrying representatives from the oil company Occidental landed in Omaha, Nebraska in April 2019, to interview Warren Buffett, news of the arrival extended beyond the chairman and CEO of Berkshire Hathaway. Alternative data company Quandl, which tracks private jet flights, shared news of the visit to its hedge fund clients, who reportedly pay upwards of $100,000 a year for the information. The cost paid off days later, when Buffett announced a $10 billion investment in Occidental, sending its value skyward.&lt;/p&gt;

&lt;p&gt;In the years since, "corporate aviation intelligence," as Quandell calls it, has grown in scope. Quiver Quantitative, a free alternative data platform launched in 2020 that aims to give ordinary investors a Wall Street-style edge, is now offering a corporate private jet tracker to everyone.&lt;/p&gt;

&lt;h1&gt;
  
  
  Who is using alternative data?
&lt;/h1&gt;

&lt;p&gt;Approximately half of all investment firms use alternative data in some form, and this number is likely to continue to increase. Alternative data is increasingly used by hedge funds and investment firms. Investing analysts, quant traders, and fund managers use alternative data in their algorithms to guide their strategies to generate consistently higher returns than the broad market. Furthermore, firms are also investing increasingly in alternative data as part of their investment strategies.&lt;/p&gt;

&lt;h1&gt;
  
  
  Where can I get alternative data in an actionable way?
&lt;/h1&gt;

&lt;p&gt;According to the Alternative Investment Management Association in collaboration with fintech company SS&amp;amp;C. There are 400 currently active providers. This number is more than 20 times larger now than it was 30 years ago, this tells the story of how alt data providers are fast rising.&lt;/p&gt;

&lt;h2&gt;
  
  
  Proxycurl
&lt;/h2&gt;

&lt;p&gt;For a more macro view, the hiring velocity or employee turnover rate within a company will signal to hedge funds on its situation at the moment in time. Proxycurl currently provides an exhaustive dataset of companies and their employees for investment analysis and training AI models for this analysis. As Eric Schmidt (former CEO of Google) once said, “People are the foundation of any company’s success.” This alternative data gives a valuable edge in foreseeing the performance of a company and its future trend.&lt;/p&gt;

&lt;p&gt;The article that inspired me :&lt;br&gt;
&lt;a href="https://nubela.co/blog/the-ultimate-guide-to-alternative-data-what-is-it-really/"&gt;Proxycurl - "The Ultimate Guide to Alternative Data - What Is It Really?"&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Contemplate with me : mitt.js</title>
      <dc:creator>Ibrahim Elhofy</dc:creator>
      <pubDate>Sun, 12 Jun 2022 17:11:03 +0000</pubDate>
      <link>https://forem.com/ibrahim-elhofy/contemplate-with-me-mittjs-39ib</link>
      <guid>https://forem.com/ibrahim-elhofy/contemplate-with-me-mittjs-39ib</guid>
      <description>&lt;p&gt;In this article, I'm going to explain some shine lines that I have found in this tiny library, and what we can learn from them.&lt;br&gt;
Before diving into these lines you should have the basics of typescript and javascript.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is mitt.js
&lt;/h2&gt;

&lt;p&gt;mitt describes itself as a tiny 200-byte functional event emitter / pubsub.&lt;br&gt;
And this is what makes the mitt awesome because the priority of the mitt's size, makes its creator look for solutions that keep their library tiny and awesome at the same time.&lt;/p&gt;
&lt;h2&gt;
  
  
  Our material
&lt;/h2&gt;

&lt;p&gt;This is the code that we will explain. Check it well to understand what is doing, before continuing reading.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * Remove an event handler for the given type.
 * If `handler` is omitted, all handlers of the given type are removed.
 * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
 * @param {Function} [handler] Handler function to remove
 * @memberOf mitt
 */&lt;/span&gt;
&lt;span class="nx"&gt;off&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Key&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="nx"&gt;Events&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;GenericEventHandler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;GenericEventHandler&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Non-null assertion operator &lt;code&gt;!.&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;GenericEventHandler&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;all&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;look at this operator &lt;code&gt;!.&lt;/code&gt; did you see it, if you like me I think this is the first time you have seen this operator before in typescript.&lt;br&gt;
This operator is a way to tell the compiler "this expression cannot be &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt; here, so don't complain about the possibility of it being &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;." Sometimes the type checker is unable to make that determination itself.&lt;/p&gt;
&lt;h2&gt;
  
  
  Bitwise operators with &lt;code&gt;.splice&lt;/code&gt; method
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;before we know why they used the bitwise operator with &lt;code&gt;.splice&lt;/code&gt; method, we should know how &lt;code&gt;.splice&lt;/code&gt; method work.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in place. To access part of an array without modifying it, see slice().&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;list1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;list1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [2]&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;list1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [1, 3, 4, 5]&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;list2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// []&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [1, 2, 3, 4] Why ?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but why, because the "indexOf" function returned here &lt;code&gt;-1&lt;/code&gt; so the &lt;code&gt;.splice&lt;/code&gt; remove the last one, so simple but the issue is we need to prevent that from happening, but how?&lt;br&gt;
here the "&amp;gt;&amp;gt;&amp;gt;" operator comes, this operator is called &lt;code&gt;Unsigned Right Shift Operator&lt;/code&gt; ( we will not talk about it here ), what you should know about this operator, it can convert &lt;code&gt;-1&lt;/code&gt; to &lt;code&gt;4294967295&lt;/code&gt;, and keep all the rest of the numbers as it is.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 4294967295&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and this is the trick, it acts as an implicit &lt;code&gt;if&lt;/code&gt; condition, if the item is &lt;code&gt;undefined&lt;/code&gt; ( here &lt;code&gt;.splice&lt;/code&gt; will return &lt;code&gt;-1&lt;/code&gt; ) the operator will convert it to this huge number &lt;code&gt;4294967295&lt;/code&gt; if not it keep it the same, and this reduces the possibility of accidentally deleting or sometimes makes it impossible&lt;/p&gt;

&lt;h3&gt;
  
  
  Finally
&lt;/h3&gt;

&lt;p&gt;I know it ended quickly but these are the things that caught my eye, and it was very interesting to explain them to you.&lt;br&gt;
if you enjoyed like me by learning from these shine lines, remember that the beauty always is in the details.&lt;/p&gt;

&lt;h4&gt;
  
  
  Resources
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/42273853/in-typescript-what-is-the-exclamation-mark-bang-operator-when-dereferenci"&gt;In Typescript, what is the ! (exclamation mark / bang) operator when dereferencing a member? - stackoverflow.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unsigned_right_shift"&gt;Unsigned right shift (&amp;gt;&amp;gt;&amp;gt;) - developer.mozilla.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you want more like this article, tell me in the comments below. bye 👋&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>tutorial</category>
      <category>opensource</category>
    </item>
    <item>
      <title>HSL-based color name</title>
      <dc:creator>Ibrahim Elhofy</dc:creator>
      <pubDate>Wed, 29 Sep 2021 01:06:36 +0000</pubDate>
      <link>https://forem.com/ibrahim-elhofy/hsl-based-color-name-3onl</link>
      <guid>https://forem.com/ibrahim-elhofy/hsl-based-color-name-3onl</guid>
      <description>&lt;p&gt;just add the lightiness parameter of hsl color to the end of color name&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="py"&gt;--white&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="py"&gt;--gray-95&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;95%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="py"&gt;--gray-65&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;65%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="py"&gt;--gray-45&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;45%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="py"&gt;--gray-30&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;30%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="py"&gt;--blue-95&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;195&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;95%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="py"&gt;--blue-45&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;195&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;45%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="py"&gt;--blue-20&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;220&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;20%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="py"&gt;--black&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;10%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
      <category>hsl</category>
      <category>cssvariables</category>
    </item>
    <item>
      <title>My Javascript Execution Context Journey</title>
      <dc:creator>Ibrahim Elhofy</dc:creator>
      <pubDate>Mon, 31 May 2021 07:53:08 +0000</pubDate>
      <link>https://forem.com/ibrahim-elhofy/in-depth-javascript-execution-context-5g36</link>
      <guid>https://forem.com/ibrahim-elhofy/in-depth-javascript-execution-context-5g36</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Execution Context&lt;/strong&gt; is a concept if you understand it, will make it easier for you to understand more deeper concepts like :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scope&lt;/li&gt;
&lt;li&gt;Scope Chain&lt;/li&gt;
&lt;li&gt;Closure&lt;/li&gt;
&lt;li&gt;Event Loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So in this article we will dive in this mysterious concept to understand what really happens under the hood in addition to digging a little bit deeper to know how &lt;code&gt;Execution Context&lt;/code&gt; works with &lt;code&gt;Web APIs&lt;/code&gt;, let's go.&lt;/p&gt;

&lt;h1&gt;
  
  
  Execution Context
&lt;/h1&gt;

&lt;p&gt;When a fragment of JavaScript code runs, it runs inside an execution context which is an abstract concept of an environment where the Javascript code is evaluated and executed By environment, we mean the value of this, variables, objects, and functions JavaScript code has access to at a particular time.&lt;/p&gt;

&lt;h2&gt;
  
  
  When is an &lt;code&gt;Execution Context&lt;/code&gt; created ?
&lt;/h2&gt;

&lt;p&gt;There are three types of code that create a new execution context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global Execution Context (GEC)&lt;/strong&gt; This is the default or base execution context When a script executes for the first time, the JavaScript engine creates it. All of the global code ( which is not inside any function or object is executed inside the global execution context ). GEC cannot be more than one because only one global environment is possible for JS code execution as the JS engine is single threaded.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Hint: In the Browser the &lt;strong&gt;Global Execution Context&lt;/strong&gt; is created if there is no javascript script in the page or even when you do not have a single line of code in a .js file and load it, you will have the Global Execution Context created.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Function Execution Context&lt;/strong&gt; It is an Execution Context like similar &lt;strong&gt;Global Execution Context&lt;/strong&gt; gets created when function is invoked, but instead of creating the global object, it creates the arguments object that contains a reference to all the parameters passed into the function:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Eval Execution Context&lt;/strong&gt; The underrated type in this Execution Context any code executed inside it also gets its own execution context, but because &lt;code&gt;eval&lt;/code&gt; is underrated I will ignore it too and in the other hand it is also not recommended, so I will not discuss it here.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Execution Context Stack
&lt;/h1&gt;

&lt;p&gt;When &lt;strong&gt;Execution Context&lt;/strong&gt; is executing it is pushed into &lt;strong&gt;Execution Contexts Stack&lt;/strong&gt; after it terminates, it popped off from the stack and this a whole process makes the javascript engine able to keep track off running function, or processes.&lt;/p&gt;

&lt;p&gt;The way that &lt;strong&gt;Execution Context Stack&lt;/strong&gt; works by can solve you the mysterious of how javascript is single threaded that is because you can't put multiple execution context in Execution Context Stack in the same time so you do one thing at run time&lt;/p&gt;

&lt;p&gt;So the execution context stack can be conceptually represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ExecutionContextStack [

  ExecutionStack &amp;lt;global&amp;gt; { ... }

]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you execute your script the javascript engine creates a new Execution Context called &lt;strong&gt;Global Execution Stack&lt;/strong&gt; we will examine it deeper later in this article, then it pushes it in our &lt;strong&gt;Execution Context Stack&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Execution Context Phases
&lt;/h1&gt;

&lt;p&gt;Our &lt;strong&gt;Execution Context&lt;/strong&gt; his life cycle walks through two phases:&lt;/p&gt;

&lt;h2&gt;
  
  
  The Creation Phase
&lt;/h2&gt;

&lt;p&gt;In this phase The execution context is created. which the JS engine is in the compilation phase and it just scans over the code to compile the code, it doesn’t execute any code and in our &lt;strong&gt;Creation Phase&lt;/strong&gt; there is a lot of things happen.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;LexicalEnvironment component is created.&lt;/li&gt;
&lt;li&gt;VariableEnvironment component is created.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Lexical Environment
&lt;/h3&gt;

&lt;p&gt;According to ECMAScript 6 specification:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A Lexical Environment is a specification type used to define the association of Identifiers to specific variables and functions based upon the lexical nesting structure of ECMAScript code&lt;br&gt;
Let’s try to simplify a few things here. A lexical environment consists of two main components: the environment record and a reference to the outer (parent) lexical environment:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Simply put, A &lt;strong&gt;Lexical Environment&lt;/strong&gt; it's the internal Javascript Engine construct for let-defined variables. If you define a variable with let in a function , it is only visible within the function.&lt;/p&gt;

&lt;p&gt;To keep all things simple let's put what we have just learned into code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;globalLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;globalConst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&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;ExecutionContextStack [

  ExecutionContext &amp;lt;global&amp;gt; {

    lexicalEnvironment {
       globalLet : &amp;lt;uninitialized&amp;gt;,
       globalConst : &amp;lt;uninitialized&amp;gt;,
       globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
    }

  }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each Lexical Environment has three components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Environment Record&lt;/li&gt;
&lt;li&gt;Reference to the outer environment,&lt;/li&gt;
&lt;li&gt;This binding.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Environment Record
&lt;/h4&gt;

&lt;p&gt;You can think of it like a dictionary in which declarations of variables and functions are stored within the lexical environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;globalLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;globalConst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&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;ExecutionContextStack [

  ExecutionContext &amp;lt;global&amp;gt; {

    lexicalEnvironment {

       EnviromentRecord {
          globalLet : &amp;lt;uninitialized&amp;gt;,
          globalConst : &amp;lt;uninitialized&amp;gt;,
          globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
       }
    }
  }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are three type subclasses inside of the Environment Record:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Declarative environment record&lt;/strong&gt; — As its name suggests, it stores variables, modules and classes, in addition to function declarations, you can think about this concept as instantiations of something you know, like maps or tables to store declared objects in it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Object environment record&lt;/strong&gt; — It is an &lt;strong&gt;Environment Record&lt;/strong&gt; that associated with an object called &lt;code&gt;binding object&lt;/code&gt; and for each of its properties a corresponding entry is created in the OER.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is why you can access global variables such as &lt;code&gt;window.document&lt;/code&gt; that is because &lt;code&gt;window&lt;/code&gt; object is associated global execution context's object environment record any mutation on any on &lt;code&gt;window&lt;/code&gt; applies on the record&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;globalLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;globalConst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&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;ExecutionContextStack [

  ExecutionContext &amp;lt;global&amp;gt; {

    lexicalEnvironment {

      EnviromentRecord {
        [[ type ]] : 'declarative'
        globalLet : &amp;lt;uninitialized&amp;gt;
        globalConst : &amp;lt;uninitialized&amp;gt;
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
      }

      // binding with `window` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
      }
    }
  }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Reference to the Outer Environment
&lt;/h4&gt;

&lt;p&gt;Every Environment Record has an &lt;code&gt;[[ outerEnv ]]&lt;/code&gt; a reference to the outer environment ( the environment from which it was called ) to make the javascript engine able to look for variables inside the outer environment if they are not found in the current lexical environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;globalLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;globalConst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;localArgument&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;localLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;localProperty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&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;ExecutionContextStack [

  ExecutionContext &amp;lt;globalFunction&amp;gt; {

    lexicalEnvironment {

      EnviromentRecord {
        [[ type ]] : 'declarative'
        arguments : { 0 : &amp;lt;ref to "localArgument" argument&amp;gt;, length : 1 }
        localLet : 3
      }

      // binding with `arguments` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        localArgument : undefined
      }

      // binding with `this` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        localProperty : undefined
      }

      this: &amp;lt;ref to "globalFunction" object&amp;gt;

    }

  }

  ExecutionContext &amp;lt;global&amp;gt; {

    lexicalEnvironment {

      EnviromentRecord {
        [[ type ]] : 'declarative'
        window : &amp;lt;ref to "window" object&amp;gt;
        globalLet : &amp;lt;unintialized&amp;gt;
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
      }

      // binding with `window` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
        fetch : &amp;lt;built-in function&amp;gt;
        setTimeout : &amp;lt;built-in function&amp;gt;
      }

      this: &amp;lt;ref to "window" object&amp;gt;

    }

  }

]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  This Binding
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;In the global execution context the value of &lt;code&gt;this&lt;/code&gt; refers to the global object ( in browsers, this refers to &lt;code&gt;window&lt;/code&gt; object )&lt;/li&gt;
&lt;li&gt; If it is called by an object reference, then the value of this is set to that object, otherwise, the value of this is set to the global object or undefined(in strict mode). For example:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;this&lt;/code&gt; refers to the reference object and it's value depending on variety variables, so :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In &lt;strong&gt;Global Execution Context&lt;/strong&gt; it refers to the global object ( &lt;code&gt;window&lt;/code&gt; in browser or &lt;code&gt;global&lt;/code&gt; in node js )&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Functional Execution Context&lt;/strong&gt; it's referencing depends on the way that function call it. if it called by an object reference, then the value of &lt;code&gt;this&lt;/code&gt; is set to that object. Otherwise, the value of &lt;code&gt;this&lt;/code&gt; is set to the &lt;code&gt;window&lt;/code&gt; object or will be of value &lt;code&gt;undefined&lt;/code&gt; ( in strict mode )
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;globalLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;localArgument&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;localLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;localProperty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&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;ExecutionContextStack [

  ExecutionContext &amp;lt;globalFunction&amp;gt; {

    lexicalEnvironment {

      EnviromentRecord {
        [[ type ]] : 'declarative'
        arguments : { 0 : &amp;lt;ref to "localArgument" argument&amp;gt;, length : 1 }
        localLet : &amp;lt;unintialized&amp;gt;
      }

      // binding with `arguments` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        localArgument : undefined
      }

      // binding with `this` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        localProperty : undefined
      }

      this: &amp;lt;ref to "globalFunction" object&amp;gt;

    }

  }

  ExecutionContext &amp;lt;global&amp;gt; {

    lexicalEnvironment {

      EnviromentRecord {
        [[ type ]] : 'declarative'
        window : &amp;lt;ref to "window" object&amp;gt;
        globalLet : &amp;lt;unintialized&amp;gt;
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
      }

      // binding with `window` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
        fetch : &amp;lt;built-in function&amp;gt;
        setTimeout : &amp;lt;built-in function&amp;gt;
      }

      this: &amp;lt;ref to "window" object&amp;gt;

    }

  }

]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Variable Environment:
&lt;/h3&gt;

&lt;p&gt;It's also a Lexical Environment so it has all the properties and components that defined above, the purpose beyond that is storing the variable (var) bindings only.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;globalVariable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&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;ExecutionContextStack [

  ExecutionContext &amp;lt;global&amp;gt; {

    lexicalEnvironment { . . . }

    variableEnvironment {

      // binding with `window` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        globalVariable : undefined
      }

      this: &amp;lt;ref to "window" object&amp;gt;

    }

  }

]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Execution Phase
&lt;/h2&gt;

&lt;p&gt;After &lt;strong&gt;Creation Phase&lt;/strong&gt; our &lt;strong&gt;Execution Context&lt;/strong&gt; walks through the &lt;strong&gt;Execution Phase&lt;/strong&gt; to bind variable initializations, variable assignments, mutability and immutability checking, variable binding deletions, function call execution, etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;globalLet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;localArgument&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;localVariable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;localProperty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;globalFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&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;ExecutionContextStack [

  ExecutionContext &amp;lt;globalFunction&amp;gt; {

    lexicalEnvironment {

      EnviromentRecord {
        [[ type ]] : 'declarative'
        arguments : { 0 : &amp;lt;ref to "localArgument" argument&amp;gt;, length : 1 }
      }

      // binding with `arguments` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        localArgument : 4
      }

      // binding with `this` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        localProperty : 3
      }

      this: &amp;lt;ref to "globalFunction" object&amp;gt;

    }

  }

  ExecutionContext &amp;lt;global&amp;gt; {

    lexicalEnvironment {

      EnviromentRecord {
        [[ type ]] : 'declarative'
        window : &amp;lt;ref to "window" object&amp;gt;
        globalLet : 0
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
      }

      // binding with `window` object
      EnviromentRecord {
        [[ type ]] : 'objective'
        globalFunction : &amp;lt;ref to "globalFunction" function&amp;gt;
        fetch : &amp;lt;built-in function&amp;gt;
        setTimeout : &amp;lt;built-in function&amp;gt;
      }

      this: &amp;lt;ref to "window" object&amp;gt;

    }

  }

]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the end I advice you to read this article several times to fully understanding these all concepts&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;h1&gt;
  
  
  Sources
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/20139050/what-really-is-a-declarative-environment-record-and-how-does-it-differ-from-an-a"&gt; stackoverflow - What really is a declarative environment record and how does it differ from an activation object? &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/12599965/lexical-environment-and-function-scope"&gt; stackoverflow - Lexical environment and function scope &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/500431/what-is-the-scope-of-variables-in-javascript?rq=1"&gt; stackoverflow - What is the scope of variables in JavaScript? &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/40691226/whats-the-difference-between-lexicalenvironment-and-variableenvironment-in"&gt; stackoverflow - What's the difference between "LexicalEnvironment" and "VariableEnvironment" in spec &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/@bdov_/javascript-typescript-execution-vs-lexical-vs-variable-environment-37ff3f264831"&gt; medium - JavaScript/TypeScript: Execution vs. Lexical vs. Variable Environment &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://2ality.com/2019/07/global-scope.html"&gt; 2ality - How do JavaScript’s global variables really work? &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://amnsingh.medium.com/lexical-environment-the-hidden-part-to-understand-closures-71d60efac0e0"&gt; medium - Lexical Environment — The hidden part to understand Closures &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dev.to/luigircruz/javascript-execution-context-38cn"&gt; dev.to - JavaScript Execution Context &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/12599965/lexical-environment-and-function-scope"&gt; stackoverflow - Lexical environment and function scope &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://youtube.com/watch?v=uH-tVP8MUs8"&gt; youtube - The Scope Chain, 🔥Scope &amp;amp; Lexical Environment | Namaste JavaScript Ep. 7 &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://link.medium.com/1EcgFcs2ygb"&gt; medium - Execution context in JavaScript &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://youtube.com/watch?v=iLWTnMzWtj4"&gt; youtube - How JavaScript Code is executed? ❤️&amp;amp; Call Stack | Namaste JavaScript Ep. 2 &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.greenroots.info/understanding-javascript-execution-context-like-never-before-ckb8x246k00f56hs1nefzpysq"&gt; green roots - Understanding JavaScript Execution Context like never before &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://javascripttutorial.net/javascript-execution-context"&gt; javascript tutorial - Understanding JavaScript Execution Context By Examples &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://link.medium.com/cbeO1Tf3ygb"&gt; medium - Understanding Execution Context and Execution Stack in Javascript &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
