<?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>DEV Community: Vaishali JS</title>
    <description>The latest articles on DEV Community by Vaishali JS (@chakudi).</description>
    <link>https://dev.to/chakudi</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%2F586653%2Fe7364871-54b4-47df-b585-a347e6e7b9fe.jpg</url>
      <title>DEV Community: Vaishali JS</title>
      <link>https://dev.to/chakudi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chakudi"/>
    <language>en</language>
    <item>
      <title>Lets enter the Temporal Dead Zone 🐱‍👤</title>
      <dc:creator>Vaishali JS</dc:creator>
      <pubDate>Sun, 28 Feb 2021 09:18:00 +0000</pubDate>
      <link>https://dev.to/chakudi/lets-enter-the-temporal-dead-zone-3ald</link>
      <guid>https://dev.to/chakudi/lets-enter-the-temporal-dead-zone-3ald</guid>
      <description>&lt;p&gt;We are familiar with variable hoisting in JavaScript. If we try to access a variable (declared using &lt;code&gt;var&lt;/code&gt; keyword) before assign it any value, we get &lt;code&gt;undefined&lt;/code&gt;. But that's not the case with variables defined using &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt;. If we try to access a variable (declared using &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt;) before assigning it any value, we get &lt;code&gt;ReferenceError&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Many people believe the reason behind this behavior is that &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are not hoisted, which is not true. Just like &lt;code&gt;var&lt;/code&gt;, they are hoisted, but what they lack is the &lt;em&gt;initialization process&lt;/em&gt; which &lt;code&gt;var&lt;/code&gt; goes through but &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; do not.&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;, initialization is only complete when a value is assigned to the variable; and the period from start of the block scope to initialization of value, where we receive &lt;code&gt;ReferenceError&lt;/code&gt;, is known as the &lt;em&gt;Temporal Dead Zone&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Wrapping up: All &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are hoisted. But, unlike &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; do not go though initialization process. The time (zone) from start of block scope to actual initialization is called Temporal Dead Zone 🐱‍👤.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
