Skip to content

Instantly share code, notes, and snippets.

View DynamiteC's full-sized avatar
🎯
Focusing

Shail Sheth DynamiteC

🎯
Focusing
View GitHub Profile
@DynamiteC
DynamiteC / AnalysisOfProg.txt
Created August 12, 2018 15:12
Thinkful_Object_Analyze
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.
@DynamiteC
DynamiteC / ValidateObjectKeys.js
Created August 12, 2018 14:49
Thinkful_Object_Drills_II
// 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`
@DynamiteC
DynamiteC / ObjectCreate.js
Created August 12, 2018 14:30
Thinkful_Object_Drills
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 :)
@DynamiteC
DynamiteC / ScopeAndGlobal.txt
Created August 12, 2018 10:35
Thinkful_Scope_And_Globals
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?
@DynamiteC
DynamiteC / Average.js
Created August 12, 2018 10:25
Thinkful_Array_Loop_Drill
// 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];
}
@DynamiteC
DynamiteC / AccessArray.js
Created August 12, 2018 10:15
Thinkful_Array_Drills
function accessFirstItem(array) {
// your code goes here
return array[0];
}
function accessThirdItem(array) {
// your code goes here
return array[2];
}
@DynamiteC
DynamiteC / ErrorHandling.js
Created August 12, 2018 09:48
Thinkful_Logic_Drills
function main() {
try{
doAllTheThings();
}
catch(e)
{
console.log(e);
reportError(e);
}
}
@DynamiteC
DynamiteC / ErrorHandling.js
Created August 12, 2018 09:48
Thinkful_Logic_Drills
function main() {
try{
doAllTheThings();
}
catch(e)
{
console.log(e);
reportError(e);
}
}
@DynamiteC
DynamiteC / Temp_Conversion
Created August 12, 2018 09:40
Thinkful_Number_Drills
function celsToFahr(celsTemp) {
// your code here
return (celsTemp * 1.8)+32;
}
function fahrToCels(fahrTemp) {
// your code here
return (fahrTemp - 32)*1.8;
}
@DynamiteC
DynamiteC / Shouter.js
Created August 12, 2018 09:33
Thinkful_String_Drills
function shouter(whatToShout) {
// your code here
return whatToShout.toUpperCase() + '!!!';
}
/* From here down, you are not expected to
understand.... for now :)