Skip to content
Merged

Dev #17

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ If there's anything that you think could be improved due to misunderstanding, th
# The 1000 Things
Structure of the repo Things are as *folder > main js file*, along with the supporting HTML and CSS files.

(9) Scope example > variable-scope-by-example.js<br>
(8) Maths Hero > updated-maths-engine.js<br>
(7) Game Sounds > soundPlayer.js<br>
(6) Name Changer > namechange.js<br>
Expand All @@ -25,7 +26,7 @@ Structure of the repo Things are as *folder > main js file*, along with the supp
(2) Date and Time > myYearAndDate.js<br>
(1) Date and Time > myDayFunction.js

**Only 992 to go... o_O**
**Only 991 to go... o_O**

# Courses and Sources
**[https://www.sololearn.com/Course/JavaScript/](https://www.sololearn.com/Course/JavaScript/)**
Expand Down
10 changes: 10 additions & 0 deletions variable-scope-by-example/variable-scope-by-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var aVariableOutsideACodeBlock = 10;

if (aVariableOutsideACodeBlock == 10) {
var aVariableINSIDE = 20;
console.log("(aVariableOutsideACodeBlock) equals " + aVariableOutsideACodeBlock);
console.log("(aVariableINSIDE) equals " + aVariableINSIDE);
}
// The below works if we use var, change the var keywords to let and it will fail
// This demonstrates the better scope control of let
console.log("(aVariableINSIDE) called from outside equals " + aVariableINSIDE);