Skip to content

Instantly share code, notes, and snippets.

View mzibari's full-sized avatar

mzibari

View GitHub Profile
@mzibari
mzibari / gist:c9515a761bdd028857873bf2ec467812
Created January 18, 2020 02:40
Module 5 Checkpoint 6 Drills
https://repl.it/@MZibari/Wiseperson-generator-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/shouter-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/text-normalizer-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/text-normalizer-drill
@mzibari
mzibari / gist:78ab684760d387e9a9aac26b21c51784
Created January 18, 2020 03:25
Module 5 Checkpoint 7 Drills
https://repl.it/@MZibari/area-of-a-rectangle-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/temperature-conversion-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/Is-divisible-drill?lite=&classroom_template=&outputonly=&fileName=
@mzibari
mzibari / gist:adf406ee4c4084dcf5994182b5ddbaeb
Created January 18, 2020 22:39
Module 5 Checkpoint 7 Drills
https://repl.it/@MZibari/Traffic-lights-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/Error-alert-drill?lite=&classroom_template=&outputonly=&fileName=
@mzibari
mzibari / gist:4ccd92b96d3a35f78e3f6a3879ab49ea
Created January 20, 2020 02:36
Module 5 Checkpoint 9 Drills
https://repl.it/@MZibari/Creating-arrays-drill
https://repl.it/@MZibari/Adding-array-items-drills
https://repl.it/@MZibari/Accessing-array-items-drill
https://repl.it/@MZibari/Array-length-and-access-drill
https://repl.it/@MZibari/Array-copying-I-drill
https://repl.it/@MZibari/Array-copying-II-drill
https://repl.it/@MZibari/Squares-with-map-drill
https://repl.it/@MZibari/Sort-drill
https://repl.it/@MZibari/Filter-drill
https://repl.it/@MZibari/Find-drill
@mzibari
mzibari / gist:0a5947a7da2a677ea991652e33c2fdd8
Created January 20, 2020 03:23
Module 5 Checkpoint 10 Drills
https://repl.it/@MZibari/min-and-max-without-sort-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/average-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/fizzbuzz-drill-js?lite=&classroom_template=&outputonly=&fileName=
@mzibari
mzibari / Module 5 Checkpoint 11 Assignment
Last active January 20, 2020 04:10
Answers to assignment questions
Scope is the accessibility to a vairable in different parts of the program. Global variables can be accessed anywhere in the program, while block variables can only be accessed within that particular block that they're declared in.
Global variables should be avoided, except in specific cases, because they will cause unintended side effects that will cause bugs, especially in larger programs, that will be hard to track down.
Strict mode will trigger an uncaught reference error any time a variable is declared without 'let' or 'const' keywords, it's used to stop the accidental creation of indeteminate code.
Side effects are the accidental alteration of a global variable's value that will effect the outputs of a different function or a block of code. Pure function is a function that when provided with the same inputs will always have the same outputs.
https://repl.it/@MZibari/Object-creator-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/Object-updater-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/Self-reference-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/Deleting-keys-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/Make-student-reports-drill?lite=&classroom_template=&outputonly=&fileName=
https://repl.it/@MZibari/Enroll-in-summer-school-drill
https://repl.it/@MZibari/find-by-id-drill
We start with the function "getTokens", which takes a single argument "rawString". it will change all letters to lower case letters, since java script is case sensative, when we compare the amount of times a particular word has occured, we don't want the word "This" be considered a diffirent word from "this". Then the function will remove all symboles and return all the words as an array of strings. In our code, the returned array will be stornd in "words" array.
We then create an object "wordFrequencies" that we will later use to store all unique words as keys, and the frequency of thoses keys as thier values.
After that, we itirate through the "words" array using a for loop, counting each occurance of words and storing that information in our "wordFrequencies" object.
In the last part, we use a for(...in...) loop to determine which key has the largest frequency, and based on that result, we return the key of the most frequent word.
There's a more detailed line by line description of the code in the link bel
@mzibari
mzibari / CSS file
Last active February 13, 2020 00:23
Quiz App
*{
text-align: center;
font-family: 'Anton', sans-serif;
font-size: 30px;
}
body{
/*background-image: url("https://cdn.stocksnap.io/img-thumbs/960w/ANC5ACJ7V0.jpg");*/
background-repeat: repeat;
}