Skip to content

Instantly share code, notes, and snippets.

@jcharles22
jcharles22 / gist:450d9ea09bea655bd589e4d8dc9a64a4
Last active February 18, 2019 20:28
Working with Strings
Wiseperson generator - https://repl.it/@JaredCharles/Wiseperson-generator
Shouter - https://repl.it/@JaredCharles/Shouter
Text normalizer - https://repl.it/@JaredCharles/Text-normalizer
https://repl.it/@JaredCharles/Area-of-a-rectangle
https://repl.it/@JaredCharles/Temperature-conversion
https://repl.it/@JaredCharles/Is-divisible
https://repl.it/@JaredCharles/Traffic-lights
https://repl.it/@JaredCharles/Error-alert
https://repl.it/@JaredCharles/Creating-arrays-drill
https://repl.it/@JaredCharles/Adding-array-items-drills
https://repl.it/@JaredCharles/Accessing-array-items-drill
https://repl.it/@JaredCharles/Array-length-and-access-drill
https://repl.it/@JaredCharles/Array-copying-I-drill
https://repl.it/@JaredCharles/Array-copying-II-drill
https://repl.it/@JaredCharles/Squares-with-map-drill
https://repl.it/@JaredCharles/Sort-drill
https://repl.it/@JaredCharles/Filter-drill
https://repl.it/@JaredCharles/Find-drill
https://repl.it/@JaredCharles/min-and-max-without-sort-drill
https://repl.it/@JaredCharles/average-drill
https://repl.it/@JaredCharles/fizzbuzz-drill-js
What is scope? Your explanation should include the idea of global vs. block scope.
Scope is the accessibility of the variables you create to different places in your code. You have global and block scope if you create a variable in the global scope it is being declared outside of any function. Block scope variables are declared with-in a function and they can only be accessed in that function or functions nested in that one.
Why are global variables avoided?
Global variables are avoided because, they can be accessed and changed from anywhere. Making it easy for your code to have errors. Also, it makes your code harder to read. Global variables can even be accessed from different files as long as the file gets loaded before the variable gets called.
Explain JavaScript's strict mode
JavaScript’s strict mode checks your code and throws error when some conditions are met where other times no error would be thrown. Such as anytime you declare a variable without let or const, an error will be trigger
https://repl.it/@JaredCharles/Object-creator-drill
https://repl.it/@JaredCharles/Object-updater-drill
https://repl.it/@JaredCharles/Self-reference-drill
https://repl.it/@JaredCharles/Deleting-keys-drill
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
// returns an array of strings. splits it by symbols and spaces and has been sorted.
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
}
// text is a body of text like a paragraph from a novel, or song lyrics
function mostFrequentWord(text) {
// declares words and passes text to the function getTokens() and returns it as an array of strings.
let words = getTokens(text);
<main role="main">
<h1>Jared Charles</h1>
<p>I am a fullstack developer!</p>
</main>
<p>About Me:</p>
<ul>
<li>I am currently working through the Thinkful fullstack
course. My biggest hobby is programming it lets me make something that didn't exist
and i love problem solving. Outside of programming, i am either playing basketball,
hanging out with friends, or just spending time with my wife.
@jcharles22
jcharles22 / desktop about me.jpg
Last active March 22, 2019 03:18
design portfolio
desktop about me.jpg