whyLocalVarCallLet.html
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
<a href="/link-tree.html">Link Tree</a>
22
</nav>
23
</header>
24
25
<ol role="navigation" class="breadcrumbs" aria-roledescription="Site breadcrumb">
26
<li>
27
<a href="/">Index</a>
28
</li>
29
30
<li >
31
<a href="/blog">
32
Blog Index
33
</a>
34
</li>
35
36
<li aria-current="location">
37
38
Why local variables are called "let"
39
40
</li>
41
42
</ol>
43
<main>
44
<article>
45
<h2 id="blog-post-titled">Why local variables are called "let"</h2>
46
<time>2022 Jan 10</time>
47
<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>
48
49
</article>
50
</main>
51
<footer role="group">
52
<div class="footer-link-list-holder">
53
<span aria-hidden="true" id="footer-label-social-accounts" class="footer-link-list-label">Social Accounts</span>
54
<ol class="footer-link-list" aria-labelledby="footer-label-social-accounts">
55
<li><a href="https://mastodon.social/@S0G" rel="me">Mastodon</a></li>
56
<li><a href="https://youtube.com/@s0g">YouTube</a></li>
57
</ol>
58
</div>
59
</footer>
60
</body>
61
62
</html>