<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tentorbest on Medium]]></title>
        <description><![CDATA[Stories by Tentorbest on Medium]]></description>
        <link>https://medium.com/@tentorbest?source=rss-435391c10825------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HqDIpi3RsbefNVDb</url>
            <title>Stories by Tentorbest on Medium</title>
            <link>https://medium.com/@tentorbest?source=rss-435391c10825------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:37:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tentorbest/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Difference Between let, const, and var in JavaScript]]></title>
            <link>https://medium.com/@tentorbest/difference-between-let-const-and-var-in-javascript-ca523b0d8ef1?source=rss-435391c10825------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca523b0d8ef1</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript-variable]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Tentorbest]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 04:07:16 GMT</pubDate>
            <atom:updated>2026-03-28T04:07:16.922Z</atom:updated>
            <content:encoded><![CDATA[<p>Variables are one of the most fundamental concepts in JavaScript, they are containers for storing data values that can be used and manipulated throughout a program.</p><p>The three main ways JavaScript declares variables are:</p><ol><li><strong><em>var</em></strong><em> ; </em>this is the old way of declaring variables before <em>let</em> and <em>const</em> . It declares function-scoped(i.e. inside a specific function) or globally-scoped(i.e. outside any specific function) variables, optionally initializing each to a value.</li></ol><p>This can be run;</p><blockquote>var x = 5;<br>var y = 6;<br>var total = x + y; // total will be 11</blockquote><p>2.<strong><em> let ; </em></strong>this is the modern way of declaring variable and it cannot be redeclared unlike <strong><em>var</em></strong> that can be redeclared. It is used to declare a re-assignable, block-scoped local variable i.e. only accessible within the specific code block in the curly braces.</p><blockquote>let username;<br>username = “Peace”;<br>console.log(username); // Output: “Peace”</blockquote><p>3. <strong><em>const; </em></strong>Just like the name implies, “constant” a constant cannot be changed<strong><em>. </em></strong>A <strong><em>const</em></strong> variable must be assigned a value when it is declared. It cannot be declared first and assigned later<strong><em> .</em></strong></p><p>This can be declared by;</p><blockquote>// Correct<br>const PI = 3.14159;<br>const PI = 4;</blockquote><blockquote>// Incorrect (will throw a SyntaxError: Missing initializer in const declaration)</blockquote><p><strong><em>This example shows that a value must be assigned while declaring a const, and this assigned value cannot be changed nor redeclared within the same scope.</em></strong></p><p><strong>CONCLUSION</strong></p><p>The<strong><em> var</em></strong>, <strong><em>let</em></strong> and <strong><em>const</em></strong> differs from each other in that;</p><ol><li><strong><em>var</em></strong> and <strong><em>let</em></strong> can be reassigned but not <strong><em>const</em></strong>.</li><li><strong><em>var </em></strong>can be redeclared within the same scope but <strong><em>let</em></strong> and <strong><em>const</em></strong> cannot be redeclared within the same scope.</li><li><strong><em>var </em></strong>can be hoisted and initialized with undefined but not <strong><em>let</em></strong> nor <strong><em>const.</em></strong></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca523b0d8ef1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>