Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
View String drills lesson 3
View Number Drills
View Logic Drills
View Array Basics
View Array Method Drills
View Arrays and Loops Drills
View Scope vs global variables
1. Scope is a term that allows to know where certain variables can be used. If the scope of variable is global it can be used anywhere
in your code. If the scope of the variable is block it can only be used in the block it was created.
2.Global Variables are avoided since they can cause unintended consequences/side effects.
3.JavaScript's strict mode makes sure that global variables can't be used.
4. A side effect is when a function affects things outside its own scope and changes the values in a completely different block/scope.
A pure function is one that doesnt have any side effects and it is determinate.
View Object Drills 1
View Object Drills 2
View most frequent word analyzer
get tokens tokenizes the string
loop through each word and if this is the first time seeing it make the counter for it 1, otherwise increment the counter by 1
loop through the word freq array and save the word that has the highest freq
output word with highest freq