Skip to content

Instantly share code, notes, and snippets.

View ElenaG518's full-sized avatar

ElenaG518 ElenaG518

View GitHub Profile
@ElenaG518
ElenaG518 / WisePerson
Created May 17, 2018 20:15
String Drills
function wisePerson(wiseType, whatToSay) {
// your code here
let phrase = (
`A wise ${wiseType} once said: "${whatToSay}".`);
return phrase;
}
/* From here down, you are not expected to
understand.... for now :)
https://repl.it/@elenaG518/Is-divisible-drill
https://repl.it/@elenaG518/temperature-conversion-drill
https://repl.it/@elenaG518/area-of-a-rectangle-drill
@ElenaG518
ElenaG518 / Logic Drills
Created May 17, 2018 22:17
Logic Drills
https://repl.it/@elenaG518/Traffic-lights-drill
https://repl.it/@elenaG518/Error-alert-drill
https://repl.it/@elenaG518/Adding-array-items-drills
https://repl.it/@elenaG518/Creating-arrays-drill
https://repl.it/@elenaG518/Accessing-array-items-drill
https://repl.it/@elenaG518/Array-length-and-access-drill
https://repl.it/@elenaG518/Array-copying-I-drill
https://repl.it/@elenaG518/Squares-with-map-drill-1
https://repl.it/@elenaG518/Array-copying-II-drill
https://repl.it/@elenaG518/Sort-drill
https://repl.it/@elenaG518/Filter-drill
https://repl.it/@elenaG518/Find-drill
https://repl.it/@elenaG518/min-and-max-without-sort-drill
https://repl.it/@elenaG518/average-drill
https://repl.it/@elenaG518/fizzbuzz-drill-js
https://repl.it/@elenaG518/Object-creator-drill
https://repl.it/@elenaG518/Object-updater-drill
https://repl.it/@elenaG518/Self-reference-drill
https://repl.it/@elenaG518/Deleting-keys-drill
https://repl.it/@elenaG518/Make-student-reports-drill
https://repl.it/@elenaG518/Enroll-in-summer-school-drill
https://repl.it/@elenaG518/find-by-id-drill
https://repl.it/@elenaG518/validate-object-keys-drill
https://repl.it/@elenaG518/Cat-carousel-jQuery
https://repl.it/@elenaG518/return-of-fizz-buzz
@ElenaG518
ElenaG518 / VariableScope
Created July 11, 2018 00:30
Variable Scope
What is scope? Your explanation should include the idea of global vs. local scope.
Scope means where the variable lives and how it can be accessed. the value of global scoped variables var and let can be accessed and modified by any
function that refers to it. When you declare a variable in the global scope, it is available everywhere in your code.
Any variable that is declared outside of a function in JavaScript has global scope. When you declare a variable within a function,
that variable only lives within the function, meaning it's scope is local. This means that when you define a variable in a function that
has the same name as a variable in the global scope, the local variable will take precedence over the global one.
Why are global variables avoided?
Global variables should be avoided because they could inadvertently be reassigned a value by a function that refers to it,
even functions in a different file in which the global variable is being defined. This could create problems in the expected