This file contains hidden or 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 shouter(whatToShout) { | |
// your code here | |
return whatToShout.toUpperCase() + '!!!'; | |
} | |
/* From here down, you are not expected to | |
understand.... for now :) | |
This file contains hidden or 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 celsToFahr(celsTemp) { | |
// your code here | |
return (celsTemp * 1.8)+32; | |
} | |
function fahrToCels(fahrTemp) { | |
// your code here | |
return (fahrTemp - 32)*1.8; | |
} |
This file contains hidden or 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 main() { | |
try{ | |
doAllTheThings(); | |
} | |
catch(e) | |
{ | |
console.log(e); | |
reportError(e); | |
} | |
} |
This file contains hidden or 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 main() { | |
try{ | |
doAllTheThings(); | |
} | |
catch(e) | |
{ | |
console.log(e); | |
reportError(e); | |
} | |
} |
This file contains hidden or 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 accessFirstItem(array) { | |
// your code goes here | |
return array[0]; | |
} | |
function accessThirdItem(array) { | |
// your code goes here | |
return array[2]; | |
} |
This file contains hidden or 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
// noprotect | |
// ^^ `noprotect` is here to prevent a bug with jsbin and for loops. | |
function average(numbers) { | |
// your code goes here | |
var sum = 0; | |
for(var i in numbers) | |
{ | |
sum += numbers[i]; | |
} |
This file contains hidden or 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? | |
Scope is what we say something that is only accessible to the current block. so when we say a global scope that says us that this would accessible throughtout the code while local scope would be accessible to the only block where it was defined. | |
Why are global variables avoided? | |
Main reason behind the avoiding the global variables is that when in need of the updated global variable it might not be one we're looking for. | |
Explain JavaScript's strict mode. | |
Strict Mode is use so that the code throws more exceptions and certain actions are also prevented from doing stuff they are meant to do. | |
What are side effects, and what is a pure function? |
This file contains hidden or 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 createMyObject() { | |
// your code here | |
return {'foo':'bar','answerToUniverse':42,'olly olly':'oxen free','sayHello':function () {return 'hello'}}; | |
} | |
/* From here down, you are not expected to | |
understand.... for now :) |
This file contains hidden or 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
// running the function with `objectA` and `expectedKeys` | |
// should return `true` | |
var objectA = { | |
id: 2, | |
name: 'Jane Doe', | |
age: 34, | |
city: 'Chicago' | |
} | |
// running the function with `objectA` and `expectedKeys` |
This file contains hidden or 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
First function getTokens tells me that it takes the rawstring that is the string | |
(a paragraph) in raw form and what this function does is that it lowercase the string | |
cut downs into a group(array) by splitting it with various factor and filter out and sort them in | |
ascending order. | |
Next Function MostFrequentWord takes text as input and the first lines does it what i | |
written about on the function. it defines the object wordfrequencies which would take the | |
all the words occurring in the array and whenever it finds one it increases the count of | |
the word. |
OlderNewer