Skip to content

Instantly share code, notes, and snippets.

View 821jieun's full-sized avatar

jieun 821jieun

  • nyc
View GitHub Profile
821jieun / gist:fc4d0229485cae77b83ff8b7ae385ce4
Created February 14, 2018 15:38
Links to string drills
View gist:fc4d0229485cae77b83ff8b7ae385ce4
View gist:d476637d0f6ffe9303c2233d4be9b83c
View gist:6ea9a629a4b32fc847113cf2df98beaa
View gist:5b0f63b534cde76108c9763f4db4b52c
View Array methods drill
821jieun / gist:bd4c6304491debb32c34147147479e28
Created February 14, 2018 17:07
Arrays and Loops Drills
View gist:bd4c6304491debb32c34147147479e28
821jieun / gist:7f18fb0c20853bd023629bcf7b12dd89
Created February 14, 2018 18:12
Challenge: in your own words
View gist:7f18fb0c20853bd023629bcf7b12dd89
What is scope? Your explanation should include the idea of global vs. local scope.
Scope is the area in which a variable is available.
Local scope is when the variable is defined and used within a specific function. Local scope is re-created
each time the function is called.
Global scope is when the variable is defined outside of a function.
The interpreter follows a scope chain to check the availability of a variable. It will first check local scope;
then it will check parent scope; then it will check the global scope.
Why are global variables avoided?
Use of global variables can make a function indeterminate. This means that a when a function is given the same input
View Object drills 1
View Object drills 2
821jieun / gist:611089050e21047f3a552cbe458918f1
Created February 14, 2018 20:23
most frequent word analyzer challenge
View gist:611089050e21047f3a552cbe458918f1
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
//all capitalized letters are turned into lower case letters in the raw string.
//that all lower case string is then being split where punctuation marks are found.
//falsy items are removed.
//the string is then sorted alphabetically and is the return value of the getTokens function call.