Skip to content

Instantly share code, notes, and snippets.

View laurajodz's full-sized avatar

Laura Jodz laurajodz

  • California
View GitHub Profile
https://repl.it/G8oY/latest
https://repl.it/G8sD/latest
https://repl.it/G8sU/latest
https://repl.it/G9Do/latest
https://repl.it/G9EI/latest
https://repl.it/G9Ec/latest
https://repl.it/Ggbk/latest
https://repl.it/Ggcp/latest
https://repl.it/G9GB/latest
https://repl.it/G9GI/latest
https://repl.it/G9GO/latest
https://repl.it/G9GS/latest
https://repl.it/G9GV/latest
https://repl.it/G9G7/latest
https://repl.it/G9HI/latest
https://repl.it/G9H5/latest
https://repl.it/G9Hd/latest
https://repl.it/G9Hl/latest
@laurajodz
laurajodz / gist:fad808c05a52648f1d2ae7645fda8587
Created October 14, 2017 18:03
JS Arrays and Loops Drills
https://repl.it/G9KJ/latest
https://repl.it/G9KO/latest
https://repl.it/G9KW/latest
What is scope? Your explanation should include the idea of global vs. local scope.
JavaScript has two scopes: global and local. A variable that is declared outside a function definition is a
global variable, and its value is accessible and modifiable throughout your program. A variable that is declared inside
a function definition is local. It is created and destroyed every time the function is executed, and it cannot be
accessed by any code outside the function.
Why are global variables avoided?
Global variables create unintended side effects, altering values outside of local scope. This causes indeterminate
https://repl.it/G9Lb/latest
https://repl.it/G9Lf/latest
https://repl.it/G9Lj/latest
https://repl.it/G9Lo/latest
https://repl.it/G9NG/latest
https://repl.it/G9N6/latest
https://repl.it/G9OF/latest
https://repl.it/G9OV/latest
https://repl.it/FfGw/latest