<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FC3%2FVariable-Keywords-and-Hoisting-in-JS%2FEnglish</id>
		<title>JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FC3%2FVariable-Keywords-and-Hoisting-in-JS%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;action=history"/>
		<updated>2026-04-09T14:28:49Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=55272&amp;oldid=prev</id>
		<title>Nancyvarkey at 05:39, 21 June 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=55272&amp;oldid=prev"/>
				<updated>2021-06-21T05:39:37Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:39, 21 June 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Author: Jayesh Katta Ramalingaiah&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Author: Jayesh Katta Ramalingaiah&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Domain Reviewer: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Domain Reviewer: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Ankita Maske&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Novice Reviewer: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Novice Reviewer: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Praveeen S.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Keywords: JavaScript, HTML, hoisting, var, let&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Keywords: JavaScript, HTML, hoisting, var, let&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nancyvarkey</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=54786&amp;oldid=prev</id>
		<title>Pravin1389 at 13:39, 3 February 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=54786&amp;oldid=prev"/>
				<updated>2021-02-03T13:39:11Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:39, 3 February 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 86:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 86:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| Only Narration&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| Only Narration&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Now, let &lt;/del&gt;us take an example and understand these better.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Let &lt;/ins&gt;us take an example and understand these better.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 349:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 349:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const pi = 3.14;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const pi = 3.14;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;pi = 3.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;142857&lt;/del&gt;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;pi = 3.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;141592&lt;/ins&gt;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| In the '''main.js '''file, replace the '''code''' as shown.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| In the '''main.js '''file, replace the '''code''' as shown.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 366:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 366:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;pi = 3.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;142857&lt;/del&gt;;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;pi = 3.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;141592&lt;/ins&gt;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| Here, I’m trying to reassign the '''variable pi''' to '''3.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;142857&lt;/del&gt;.'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| Here, I’m trying to reassign the '''variable pi''' to '''3.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;141592&lt;/ins&gt;.'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 624:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 624:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is because '''variables declared''' using '''var keyword''' &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;are &lt;/del&gt;'''hoisted'''.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is because '''variables declared''' using '''var keyword''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;'''hoisted'''.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pravin1389</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=54731&amp;oldid=prev</id>
		<title>Nancyvarkey at 09:34, 19 January 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=54731&amp;oldid=prev"/>
				<updated>2021-01-19T09:34:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;amp;diff=54731&amp;amp;oldid=54695&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Nancyvarkey</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=54695&amp;oldid=prev</id>
		<title>Kr.jayesh: Created page with &quot;Title of the script: Variable Keywords and Hoisting  Author: Jayesh Katta Ramalingaiah  Domain Reviewer:   Novice Reviewer:   Keywords: JavaScript, HTML, hoisting, var, let...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C3/Variable-Keywords-and-Hoisting-in-JS/English&amp;diff=54695&amp;oldid=prev"/>
				<updated>2021-01-13T17:50:18Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Title of the script: Variable Keywords and Hoisting  Author: Jayesh Katta Ramalingaiah  Domain Reviewer:   Novice Reviewer:   Keywords: JavaScript, HTML, hoisting, var, let...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Title of the script: Variable Keywords and Hoisting&lt;br /&gt;
&lt;br /&gt;
Author: Jayesh Katta Ramalingaiah&lt;br /&gt;
&lt;br /&gt;
Domain Reviewer: &lt;br /&gt;
&lt;br /&gt;
Novice Reviewer: &lt;br /&gt;
&lt;br /&gt;
Keywords: JavaScript, HTML, hoisting, var, let&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border = “1”&lt;br /&gt;
|| &amp;lt;center&amp;gt;'''Visual Cue'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|| &amp;lt;center&amp;gt;'''Narration'''&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Title&lt;br /&gt;
|| Hello and Welcome to the spoken tutorial on “'''Variable Keywords, Scopes and Hoisting in JS'''”.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: &lt;br /&gt;
&lt;br /&gt;
Learning Objectives&lt;br /&gt;
|| In this tutorial, we will learn about:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Variable Keywords '''&lt;br /&gt;
* '''Scopes''' and&lt;br /&gt;
* '''Hoisting'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: System Specifications&lt;br /&gt;
|| This tutorial is recorded using:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Ubuntu Linux''' OS version 18.04&lt;br /&gt;
* '''Visual Studio Code''' version 1.51.0 ('''code editor''')&lt;br /&gt;
* '''Firefox''' web browser&lt;br /&gt;
&lt;br /&gt;
However you may use any other '''browser''' of your choice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide : Pre-requisites&lt;br /&gt;
|| To practice this tutorial,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You should be familiar with writing and executing''' JS''' files'''.'''&lt;br /&gt;
* If not, please go through the prerequisite tutorials on this website.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Code files&lt;br /&gt;
|| &lt;br /&gt;
* The files used in this tutorial are available in the''' Code files''' link on this tutorial page.&lt;br /&gt;
* Pls download and extract the file.&lt;br /&gt;
* Make a copy and then use them for practising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| &lt;br /&gt;
* So, far we have learnt about '''keyword var '''and used it to declare variables.&lt;br /&gt;
* Now, we will learn 2 more '''keywords '''to declare '''variables '''and the advantages of using them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Variable Keywords&lt;br /&gt;
|| &lt;br /&gt;
* '''let keyword''' is used for smaller '''scopes''' technically called '''block scope'''&lt;br /&gt;
* '''const keyword '''is used for declaring '''constants''' like '''Pi value'''&lt;br /&gt;
&lt;br /&gt;
(whose value would not change elsewhere in the program)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Scope&lt;br /&gt;
|| &lt;br /&gt;
* The '''scope '''of '''var keyword''' is '''functional scope''', that means,&lt;br /&gt;
* The '''variable declared''' inside a '''function '''using '''var''', cannot be accessed outside the '''function'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Scope&lt;br /&gt;
|| &lt;br /&gt;
* To '''declare variables, ES6 '''has introduced two new '''keywords''':&lt;br /&gt;
** '''let''' and&lt;br /&gt;
** '''const''' &lt;br /&gt;
* They both have '''block scope'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Scope&lt;br /&gt;
|| &lt;br /&gt;
* A '''variable declared''' with '''let '''or '''const''' inside a '''loop''', '''if/else condition''' or '''switch case'''&lt;br /&gt;
* Cannot be accessed outside the '''block scope'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| Now, let us take an example and understand these better.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Show VS editor&lt;br /&gt;
|| Open '''Visual Studio Code editor'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome Page -&amp;gt; Open Folder -&amp;gt; '''Practice-JS'''&lt;br /&gt;
|| In the '''editor, '''browse and open the folder “'''Practice-JS''' ”.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Click on &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Explorer '''pane -&amp;gt; '''Practice-JS''' -&amp;gt; '''index.html'''&lt;br /&gt;
|| Under '''Practice-JS''' folder, open the file named '''index.html'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same is available in the '''Code files''' link for practice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;!DOCTYPE html&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;title&amp;gt; Variable Keywords and Hoisting &amp;lt;/title&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;script src = &amp;quot;main.js&amp;quot; &amp;gt; &amp;lt;/script&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;/html&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|| In the '''index.html '''file, update the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this code we have written a small '''HTML''' code and linked the''' JS file'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Alt + L and Alt + O &lt;br /&gt;
|| Start the '''Live server'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Show firefox&lt;br /&gt;
|| The default '''browser '''will open automatically and a new '''tab '''opens.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Firefox] Press&amp;lt;/nowiki&amp;gt;''' Ctrl + Shift + I'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Point to the browser '''developer tools'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Click on the '''Console''' tab&lt;br /&gt;
|| Now open the '''Browser developer tools''' panel and go to the '''console tab''' &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Click on &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Explorer '''pane -&amp;gt; '''Practice-JS''' -&amp;gt; '''main.js'''&lt;br /&gt;
|| Under '''Practice-JS''' folder, open the file named '''main.js'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function display() {&lt;br /&gt;
&lt;br /&gt;
var a = 10;&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Inside Function: &amp;quot;, a);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
display();&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
let b = 30;&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Inside block: &amp;quot;, b);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Outside Function: &amp;quot;, a);&lt;br /&gt;
|| In the '''main.js '''file, update the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function display() {&lt;br /&gt;
&lt;br /&gt;
var a = 10;&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Inside Function: &amp;quot;, a);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
|| Here, I have '''declared''' a '''function '''named '''display.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inside the '''function''', I have '''declared''' a '''variable '''using '''var keyword''' and assigned 10 as a value to it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To verify this, I’m using a '''log statement''' to display the text value - ‘'''Inside Function’.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
display();&lt;br /&gt;
|| Here, I’m making a '''function call '''to '''execute '''the '''declared function.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
let b = 30;&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Inside block: &amp;quot;, b);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
|| Here, I have created a '''block.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Anything you write between,''' {}''' technically is a '''block.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, I have declared '''variable b '''using '''let keyword.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To verify this, I’m using a '''log statement''' to display the text value''' '''- '''‘Inside block’.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Outside Function: &amp;quot;, a);&lt;br /&gt;
|| Here, I’m using a '''log statement''' to display the value '''‘a’''' outside the '''function'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is to verify whether we can access the value outside the '''function '''or not.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Inside Function: 10'''&lt;br /&gt;
|| As expected, when I make a '''function call '''the value 10 gets '''logged'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Inside block: 30'''&lt;br /&gt;
|| Similarly the '''block '''also gets '''executed''' after the''' function call.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It displays 30, because of the '''log statement''' written inside the '''block'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Uncaught ReferenceError: a is not defined'''&lt;br /&gt;
|| Now, as we are trying to display the value of ‘'''a’''' outside the '''function, '''we got an '''error'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The console displays, '''Uncaught ReferenceError: a is not defined'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By this we conclude that the '''variable '''which is '''declared''' using '''var '''has a '''functional scope.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Outside block: &amp;quot;, b);&lt;br /&gt;
|| In the '''main.js '''file, replace the last '''console log statement''' with the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we’ll test whether the '''variable declared''' inside the '''block '''is available outside or not.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Uncaught ReferenceError: b is not defined'''&lt;br /&gt;
|| Now, we get an '''error '''for the '''outside block log statement'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Uncaught ReferenceError: b is not defined'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By this we conclude that the '''variable declared''' inside the '''block '''is not accessible outside.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hence the '''keyword let '''has '''block''' '''scope'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| Now lets learn about the '''const keyword'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const pi = 3.14;&lt;br /&gt;
&lt;br /&gt;
pi = 3.142857;&lt;br /&gt;
|| In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const pi = 3.14;&lt;br /&gt;
|| Here, I have '''declared''' a '''variable pi '''and assigned '''3.14''' to it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the '''data type''' here is '''primitive '''('''number''').&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
pi = 3.142857;&lt;br /&gt;
|| Here, I’m trying to reassign the '''variable pi''' to '''3.142857.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Uncaught TypeError: invalid assignment to const 'pi''''&lt;br /&gt;
|| Notice we get an error- '''“Uncaught TypeError: invalid assignment to const 'pi' “.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hence, we conclude that the value for a '''const variable''' cannot be changed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| Note again, we have tested only for '''primitive data type.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, let's check for '''non-primitive data types.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const student = {&lt;br /&gt;
&lt;br /&gt;
name: &amp;quot;Jayesh&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
student.name = &amp;quot;Praveen&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(student);&lt;br /&gt;
|| In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
const student = {&lt;br /&gt;
&lt;br /&gt;
name: &amp;quot;Jayesh&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
|| Here, I have declared a '''variable '''with the name '''student.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then I have assigned an '''object '''('''non -primitive data type''') to it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''object '''contains a '''property name '''with the value '''jayesh.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
student.name = &amp;quot;Praveen&amp;quot;;&lt;br /&gt;
|| Now here, I try to change the '''property '''value from '''jayesh '''to '''praveen'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
console.log(student);&lt;br /&gt;
|| To verify what happens, I’m logging the ‘'''student’ variable'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object { name: &amp;quot;Praveen&amp;quot; }'''&lt;br /&gt;
|| Notice here, we have the value of '''name''' '''property '''changed from '''jayesh '''to '''praveen'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| By this we conclude that for '''non-primitive data types''' '''const '''acts differently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It does not modify the '''object data type. '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can add '''properties '''and change the '''property '''values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly for '''arrays''', we can add and remove values in an '''array'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Lexical Scope&lt;br /&gt;
|| In '''JavaScript''', &lt;br /&gt;
&lt;br /&gt;
* '''Variables '''which are '''declared''' outside the '''function '''or a '''block '''&lt;br /&gt;
* are available inside the '''function '''or a '''block'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| Now, let us take an example and understand this better.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
let a = 10;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function display() {&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Value of a is &amp;quot;, a);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
display();&lt;br /&gt;
|| In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight: let a = 10;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|| Here, I have '''declared''' a '''variable ‘a’''' with '''let keyword''' and assigned 10 to it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function display() {&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;Value of a is &amp;quot;, a);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
|| Then, I have created a '''function '''display and I’m trying to '''log''' the value of '''a.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
display();&lt;br /&gt;
|| Here, I make a '''function call '''to '''execute''' the '''function'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Value of a is 10'''&lt;br /&gt;
|| The value '''a''' which is declared outside the '''function '''is available inside the '''function '''too. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That's the reason '''10''' is displayed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This mechanism is called the '''lexical scope '''in''' JS.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| Now, let’s go to the next topic.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Hoisting&lt;br /&gt;
|| '''Hoisting '''is '''JavaScript’s''' default behavior of moving '''declarations''' to the top of the '''Scope '''before '''execution'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| Now, let us take an example and understand this better.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;The value of a is &amp;quot;, a);&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;The value of b is &amp;quot;, b);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var a = 10;&lt;br /&gt;
&lt;br /&gt;
let b = 20;&lt;br /&gt;
|| In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;The value of a is &amp;quot;, a);&lt;br /&gt;
&lt;br /&gt;
console.log(&amp;quot;The value of b is &amp;quot;, b);&lt;br /&gt;
|| Here, I’m trying to '''log '''the '''a''' and''' b''' values which are not '''declared''' yet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var a = 10;&lt;br /&gt;
|| Below the '''log statements''', I have declared a '''variable''' ‘'''a’ '''using the '''var keyword''' and assigned '''10''' to it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
let b = 20;&lt;br /&gt;
|| Here, I have '''declared''' a '''variable ‘b’''' using the '''let keyword '''and assigned '''20''' to it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, let’s see what happens.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]: Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''The value of a is undefined'''&lt;br /&gt;
|| Notice here, we got the value of '''a''' as '''undefined'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is because '''variables declared''' using '''var keyword''' are '''hoisted'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''declarations''' will be pushed to the top of the '''scope'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And, the value is '''undefined '''because it’s a default value.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Uncaught ReferenceError: can't access lexical declaration 'b' before initialization'''&lt;br /&gt;
|| '''Uncaught ReferenceError: can't access lexical declaration 'b' before initialization'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This happens for '''b '''because '''hoisting '''does not happen for '''let '''and '''const.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Only after '''declaration''', the values can be used. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| So we conclude that '''hoisting''' happens for '''variables declared''' with '''var''', and not for''' let''' and''' const.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Even '''functions '''can be '''hoisted'''.&lt;br /&gt;
&lt;br /&gt;
That is the reason we can '''execute''' a '''function '''before '''declaration'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only Narration&lt;br /&gt;
|| With this we have come to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let’s summarize.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide''': '''Summary''' '''&lt;br /&gt;
|| In this tutorial, we have learnt:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Variable Keywords'''&lt;br /&gt;
* '''Scopes '''and&lt;br /&gt;
* '''Hoisting'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Assignment&lt;br /&gt;
|| As an assignment,&lt;br /&gt;
&lt;br /&gt;
* Open the file '''assignment.js'''&lt;br /&gt;
* Clear the existing code&lt;br /&gt;
* Log the '''value''' '''x''' in console first before declaring '''x''' value&lt;br /&gt;
* Declare a '''variable x''' using '''const below '''the '''log statement'''&lt;br /&gt;
* Open the file '''MyPage.html '''in a '''web''' '''browser'''.&lt;br /&gt;
* Observe the output in the '''browser’s console'''&lt;br /&gt;
* An '''error '''is observed&lt;br /&gt;
* Reason: Recall that the '''variables declared''' with '''const '''will not be '''hoisted'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide: '''About Spoken Tutorial Project&lt;br /&gt;
|| &lt;br /&gt;
* The video at the following link summarises the Spoken Tutorial project.&lt;br /&gt;
* Please download and watch it&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide:''' Spoken tutorial workshops&lt;br /&gt;
|| &lt;br /&gt;
* We conduct workshops using spoken tutorials and give certificates.&lt;br /&gt;
* For more details, please write to us.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Forum questions&lt;br /&gt;
|| Pls post your timed queries in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Acknowledgement&lt;br /&gt;
|| Spoken Tutorial Project is funded by Ministry of Education (MoE), Government of India&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Thanks&lt;br /&gt;
|| The script for this tutorial is contributed by Jayesh.&lt;br /&gt;
&lt;br /&gt;
And this is Praveen from IIT Bombay signing off. &lt;br /&gt;
&lt;br /&gt;
Thank you for joining.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Kr.jayesh</name></author>	</entry>

	</feed>