Skip to content

Instantly share code, notes, and snippets.

View rob137's full-sized avatar

Rob rob137

  • Oxford, United Kingdom
View GitHub Profile
@rob137
rob137 / Shouter-Drill
Created November 28, 2017 16:54
Thinkful 2.2.3 JS drill answers
// https://repl.it/@robertaxelkirby/shouter-drill
function shouter(whatToShout) {
whatToShoutInCaps = whatToShout.toUpperCase();
return `${whatToShoutInCaps}!!!`
}
/* From here down, you are not expected to
understand.... for now :)
// https://repl.it/@robertaxelkirby/Is-divisible-drill
function isDivisible(divisee, divisor) {
if (divisee % divisor == 0) {
return true;
}
return false;
}
/* From here down, you are not expected to
// https://repl.it/@robertaxelkirby/Error-alert-drill
function main() {
try {
doAllTheThings();
}
catch(e) {
reportError(e);
}
}
// https://repl.it/@robertaxelkirby/Accessing-array-items-drill
function accessFirstItem(array) {
return array[0];
}
function accessThirdItem(array) {
return array[2];
}
// https://repl.it/@robertaxelkirby/Array-copying-I-drill
function firstFourItems(array) {
return array.slice(0,4);
}
function lastThreeItems(array) {
return array.slice(array.length-3, array.length);
}
/* From here down, you are not expected to
// https://repl.it/@robertaxelkirby/average-drill
function average(numbers) {
let total = 0
for (let i = 0; i < numbers.length; i++) {
total += numbers[i];
}
return total/numbers.length;
}
https://repl.it/@robertaxelkirby/Object-creator-drill
https://repl.it/@robertaxelkirby/Object-updater-drill
https://repl.it/@robertaxelkirby/Self-reference-drill
https://repl.it/@robertaxelkirby/Deleting-keys-drill
@rob137
rob137 / 2.6.5
Created November 30, 2017 08:04
https://repl.it/@robertaxelkirby/Make-student-reports-drill
https://repl.it/@robertaxelkirby/Enroll-in-summer-school-drill
https://repl.it/@robertaxelkirby/find-by-id-drill
https://repl.it/@robertaxelkirby/validate-object-keys-drill
/*
Example lyrics used throughout:
jude = "Hey jude, don't make it bad. Take a sad song and make it better."
jude += " Remember to let her into your heart, Then you can start to make it better."
*/
function getTokens(rawString) {
/*
This function takes the original lyrics and:
https://repl.it/@robertaxelkirby/Cat-carousel-jQuery
https://repl.it/@robertaxelkirby/return-of-fizz-buzz