A mirror of my website's source code.

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 whyLocalVarCallLet.html

View raw Download
text/html • 2.75 kiB
HTML document, ASCII text, with very long lines (1324)
        
            
1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
6
7
<meta charset="UTF-8" />
8
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
<title>Why local variables are called "let" - S0G</title>
10
<link rel="stylesheet" href="/src/global.css" />
11
12
<link rel="stylesheet" href="/src/pygments-friendly.css" />
13
14
</head>
15
16
<body>
17
<header>
18
<h2><a href="/">Steve0Greatness</a></h2>
19
<nav>
20
<a href="/blog">Blog</a>
21
</nav>
22
</header>
23
24
<ol role="navigation" class="breadcrumbs" aria-roledescription="Site breadcrumb">
25
<li>
26
<a href="/">Index</a>
27
</li>
28
29
<li >
30
<a href="/blog">
31
Blog Index
32
</a>
33
</li>
34
35
<li aria-current="location">
36
37
Why local variables are called "let"
38
39
</li>
40
41
</ol>
42
<main>
43
<article>
44
<h2 id="blog-post-titled">Why local variables are called "let"</h2>
45
<time>2022 Jan 10</time>
46
<p><p>In JavaScript there are 3 different kinds of variables, global variables(using <span class="code">var</span>), constants(<span class="code">const</span>, and local variables(<span class="code">let</span>). All of the act allittle differently from eachother. Allow me to explain what they do.</p><p>Global variables, made using <span class="code">var</span>, are as they sound, global variables. Once defined, they can be used, edited, or redefind anywhere.</p><p>Constants, defined with <span class="code">const</span>, are constant, they cannot change, at all.</p><p>Local variables, defined with <span class="code">let</span>, are variables that can only be used in the place that it is defined, like a function, and it's children.</p>Now that we has that established, <em>let</em>'s talk about how local variables got their name.<p>Turns out "let" is a mathematical term. <span class="quote">The <b>"let" expression</b> may also be defined in mathematics, where it associates a Boolean condition with a restricted scope.</span> <a href="https://en.m.wikipedia.org/wiki/Let_expression" class="source">[source]</a>. It was first used in programming in early languages like Basic.</p>In case you're wondering, the main source is <a href="https://stackoverflow.com/a/37917071">this answer on Stack Overflow</a>.</p>
47
48
</article>
49
</main>
50
<footer role="group">
51
<div class="footer-link-list-holder">
52
<span aria-hidden="true" id="footer-label-social-accounts" class="footer-link-list-label">Social Accounts</span>
53
<ol class="footer-link-list" aria-labelledby="footer-label-social-accounts">
54
<li><a href="https://mastodon.social/@S0G" rel="me">Mastodon</a></li>
55
<li><a href="https://youtube.com/@s0g">YouTube</a></li>
56
</ol>
57
</div>
58
</footer>
59
</body>
60
61
</html>