This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/beqijim/2/edit?html,js,console | |
https://jsbin.com/wataqor/2/edit?html,js,console | |
https://jsbin.com/gocubos/edit?html,js,console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/cogeluy/edit?html,js,output | |
https://jsbin.com/dehega/edit?html,js,console | |
https://jsbin.com/nayofe/edit?html,js,console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/zijeyul/edit?html,css,js,output | |
https://jsbin.com/gobezuj/edit?html,css,js,output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/mukecoc/edit?html,js,console,output | |
https://jsbin.com/tatutej/edit?html,js,console,output | |
https://jsbin.com/tuyusib/edit?html,js,console,output | |
https://jsbin.com/fefusog/edit?html,js,console,output | |
https://jsbin.com/copeyow/edit?html,js,console,output | |
https://jsbin.com/lidafol/edit?html,js,output | |
https://jsbin.com/lecevom/edit?html,js,console,output | |
https://jsbin.com/wawiget/edit?html,js,console,output | |
https://jsbin.com/cojoguh/edit?html,js,console,output | |
https://jsbin.com/fazofuy/edit?html,js,console,output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/qutevo/edit?html,js,console,output | |
https://jsbin.com/lokebay/edit?html,js,console,output | |
https://jsbin.com/caxivis/edit?html,js,console,output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is scope? | |
Ans: Scope refers to the level of code block in a code file. It usually is used to differentiate the global scope and local scope; | |
The global scope refers to the whole code file, while the local scopr refers to the code block within individual functions. | |
Why are global variables avoided? | |
Ans: Global variables are usually avoided to prevent unexpected mutations of global variables that can happen unintentionally in large projects. | |
Explain javascript 'strict mode' | |
Ans: Javascript strict mode prevents potenrially dangerous actions such as the creation of variables without the 'var' declaration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/quxome/edit?html,js,console | |
https://jsbin.com/yaqegov/edit?html,js,console | |
https://jsbin.com/sisanuq/edit?html,js,console | |
https://jsbin.com/furolep/edit?html,js,console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/gaqonu/edit?html,js,console | |
https://jsbin.com/godemok/edit?html,js,output | |
https://jsbin.com/fatitu/edit?html,js,output | |
https://jsbin.com/huzeca/edit?html,js,console | |
https://jsbin.com/vidirec/edit?html,js,console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTokens(rawString) { | |
// NB: `.filter(Boolean)` removes any falsy items from an array | |
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort(); | |
} | |
function mostFrequentWord(text) { | |
// get words that have been sorted with spaces and non-alphabet characters removed | |
var words = getTokens(text); | |
var wordFrequencies = {}; | |
// add word in words and initialize count starting from 1 to each word not in the wordFrequencies object. If the word already exists in object, then simply add to the count. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jsbin.com/mexiwul/edit?html,js,output | |
https://jsbin.com/gorefag/edit?html,js,output | |
https://jsbin.com/purunav/edit?html,css,js,output |
OlderNewer