mirror of
https://github.com/JeremyLikness/vanillajs-deck
synced 2024-11-14 09:34:55 +00:00
19 lines
386 B
HTML
19 lines
386 B
HTML
<title>JavaScript Scope and Variables</title>
|
|
<h1>JavaScript Scope and Variables</h1>
|
|
<pre>var x = 1;</pre>
|
|
<pre class="appear">
|
|
// local scope
|
|
for (let x = 1; x < 100; x+=1) {...}
|
|
var y = 1;
|
|
function process(inp) {
|
|
let y = inp * 2;
|
|
return y;
|
|
}
|
|
process(y);
|
|
</pre>
|
|
<pre class="appear">
|
|
// constants
|
|
const x = 1;
|
|
x = 2; // 💣 BOOM!
|
|
</pre>
|
|
<next-slide>120-gosinta</next-slide> |