Skip to content

Instantly share code, notes, and snippets.

View markLaughlin's full-sized avatar

Mark Laughlin markLaughlin

View GitHub Profile
The following is an attempt to follow the flow of control of the program.
Flow begins at mostFrequent function:
-The mostFrequent word function begins; it takes some text as a parameter.
-The variable words is declared and initialized to the result of the function getTokens, which takes text as a parameter.
Flow goes to getTokens Function:
-The getTokens function begins; it takes a rawString as a parameter, in the case of our program, it takes takes text.
https://repl.it/@mlaughlin70/Object-creator-drill
https://repl.it/@mlaughlin70/Object-updater-drill
https://repl.it/@mlaughlin70/Self-reference-drill
https://repl.it/@mlaughlin70/Deleting-keys-drill
Question One:
A variable's scope is the area of the code where a change in the value of the variable takes effect. If a variable has global scope, then changing its value in any line of the program changes its value everywhere in the program. By contrast, if a variable has block scope, changing its value within a function only changes its value within that same function; everywhere else in the program, the value stays the same. A variable with global scope is declared outside of a function, and a varible with block scope is declared within a function.
Question Two:
c This becomes critical when multiple people are contributing to the same project and assign different values to the same variable name. One person can knowingly or unknowingly change the value of a global variable and inadvertently sabotage other parts of the project. Essentially, using global variables leads to code that is full of bugs and is generally confusing.
Question Three:
@markLaughlin
markLaughlin / gist:456a556ee3f700bb2648840319dc9787
Created March 10, 2019 21:34
Links to loops and arrays drills
https://repl.it/@mlaughlin70/min-and-max-without-sort-drill
https://repl.it/@mlaughlin70/average-drill
https://repl.it/@mlaughlin70/fizzbuzz-drill-js
@markLaughlin
markLaughlin / gist:a8bf34f94c51e2d96475d129abd2dd57
Created March 9, 2019 22:30
Links to JavaScript array drills
https://repl.it/@mlaughlin70/Accessing-array-items-drill
https://repl.it/@mlaughlin70/Array-length-and-access-drill
https://repl.it/@mlaughlin70/Array-copying-I-drill
https://repl.it/@mlaughlin70/Array-copying-II-drill
https://repl.it/@mlaughlin70/Squares-with-map-drill
https://repl.it/@mlaughlin70/Sort-drill
https://repl.it/@mlaughlin70/Filter-drill
https://repl.it/@mlaughlin70/Find-drill
https://repl.it/@mlaughlin70/Traffic-lights-drill
https://repl.it/@mlaughlin70/Error-alert-drill
@markLaughlin
markLaughlin / gist:be991c2158b46a9a7754a4ec4bfb0fd5
Last active March 5, 2019 22:03
JavaScript Numbers Drill
https://repl.it/@mlaughlin70/Is-divisible-drill
https://repl.it/@mlaughlin70/temperature-conversion-drill
https://repl.it/@mlaughlin70/area-of-a-rectangle-drill
@markLaughlin
markLaughlin / gist:1bb40490311b5b49395026bb0ff37c8f
Created March 4, 2019 22:06
Links to completed Strings Drill
https://repl.it/@mlaughlin70/Strings-Drill-One
https://repl.it/@mlaughlin70/Strings-Drill-Two
https://repl.it/@mlaughlin70/Strings-Drill-Three