Skip to content

Instantly share code, notes, and snippets.

View Manny1806's full-sized avatar

Manny1806

  • PlusQA
  • Portland
View GitHub Profile
function shouter(whatToShout) {
const shoutWords = whatToShout ;
return shoutWords.toUpperCase() + '!!!';
}
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
function computeArea(width, height) {
return width * height;
}
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
https://repl.it/@manny1806/Traffic-lights-drill
https://repl.it/@manny1806/Error-alert-drill
https://repl.it/@manny1806/Creating-arrays-drill
https://repl.it/@manny1806/Adding-array-items-drills
https://repl.it/@manny1806/Accessing-array-items-drill
https://repl.it/@manny1806/Array-length-and-access-drill
https://repl.it/@manny1806/Array-copying-I-drill
https://repl.it/@manny1806/Array-copying-II-drill
https://repl.it/@manny1806/Squares-with-map-drill
https://repl.it/@manny1806/Sort-drill
https://repl.it/@manny1806/Filter-drill
https://repl.it/@manny1806/fizzbuzz-drill-js
https://repl.it/@manny1806/average-drill
https://repl.it/@manny1806/min-and-max-without-sort-drill
1. Scope refers to the accessibility of a variable. If a variable is created outside of a function its scope is considered
to be global which means it can be accessed by any function in the javascript file. Global variables can even be accessed
by other linked Javascript files as long as the file with the global variable is loaded first. Variables that are created
in a function are considered to have local scope which means they can only be accessed within the function they were created
in. When a local scope variable is created that has the same as a global scope variable, the local variable will take
precedence over the global variable and not affect the global variable.
2. Global variables are avoided in Javascript because they can lead to unintended results. When more than one function uses
or alters a global variable it risks the outcome of the functions being not what is expected. One function might assume
a global variable has a certain value when in fact another function has
https://repl.it/@manny1806/Object-creator-drill
https://repl.it/@manny1806/Object-updater-drill
https://repl.it/@manny1806/Self-reference-drill
https://repl.it/@manny1806/Deleting-keys-drill
https://repl.it/@manny1806/Make-student-reports-drill
https://repl.it/@manny1806/Enroll-in-summer-school-drill
https://repl.it/@manny1806/find-by-id-drill
https://repl.it/@manny1806/validate-object-keys-drill
@Manny1806
Manny1806 / gist:3b9512972fee43ed51f422520ce0378b
Created April 14, 2018 16:54
tech eval code for Alex Widner
// ================================================================================
// You will be writing a series of functions beneath each block of comments below.
// Tackle each function one at a time. You may move on to a new exercise and return
// later. Run the code and the console to the right will tell you if your function
// is successfully passing the tests.
// ================================================================================
function kmToMiles (numKm){
return Math.floor(numKm/1.6);
}