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
// Use the value below whenever you need the value of Pi | |
const PI = 3.14159 ; | |
const sphereVolume = function (radius) { | |
// V = 4/3 πr³ | |
return ((4/3) * (PI * Math.pow(radius, 3))); | |
} | |
console.log(4186 < sphereVolume(10) && sphereVolume(10) < 4189); |
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
const chooseRecipe = function(bakeryA, bakeryB, recipes) { | |
let applicableRecipies = ''; | |
for (let recipe of recipes) { | |
let boolBakeryA = false; | |
let boolBakeryB = false; | |
for (let ingredient of recipe.ingredients) { | |
bakeryA.includes(ingredient) && (boolBakeryA = true); | |
bakeryB.includes(ingredient) && (boolBakeryB = true); | |
} | |
(boolBakeryA && boolBakeryB) && (applicableRecipies += recipe.name); |
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
const talkingCalendar = function(date) { | |
const dateArray = date.split('/'); | |
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | |
let friendlyDate = {day : 0, month : '', year : 0}; | |
friendlyDate.day = +dateArray[2] + (+dateArray[2] === 1 ? 'st' : (+dateArray[2] === 2 ? 'nd' : +dateArray[2] === 3 ? 'rd' : 'th')); | |
friendlyDate.month = months[(+dateArray[1]) - 1]; | |
friendlyDate.year = dateArray[0]; |
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
const calculateChange = function(total, cash) { | |
// c(hange) | |
let c = { | |
twentyDollar : 0, | |
tenDollar : 0, | |
fiveDollar : 0, | |
twoDollar : 0, | |
oneDollar : 0, | |
quarter : 0, | |
dime : 0, |
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
// In this exercise, we will be given a list of instructors and we will create a single object to organize them based on their course. | |
// Input | |
const organizeInstructors = function(instructors) { | |
let org = {}; | |
for (const i of instructors) { | |
org[i.course] ? org[i.course].push(i.name) : org[i.course] = [i.name]; | |
} | |
return org; |
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
const makeCase = function (input, scheme) { | |
(typeof scheme !== 'object') && (scheme = [scheme]); | |
let arrStr = [input]; | |
for (let sch of scheme){ | |
let i = 0; | |
let cap = false; | |
for (let c of arrStr.join('')) { | |
if (sch === 'camel') { | |
c === ' ' ? cap = true : cap === true ? (arrStr[i] = c.toUpperCase()) && (cap = false) : arrStr[i] = c; | |
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
const urlDecode = function(text) { | |
text = text.replace(/%20/g, ' '); | |
let strArray = text.split(/[(=)|(&)]+/); | |
let results = {}; | |
for (let i = 0; i < strArray.length; i += 2) | |
results[strArray[i]] = strArray[i + 1]; | |
return results | |
}; | |
console.log(urlDecode("duck=rubber")); |
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
const squareCode = function(message) { | |
msg = message.replace(/ +/g, ''); | |
let len = msg.length; | |
let sqR = Math.ceil(Math.sqrt(len)); | |
let rS = []; | |
for (let r = 0; r < sqR; r++) { | |
for (let i = 0; i < sqR; i++) { | |
rS.push(msg[r + (i * sqR)]) | |
} | |
rS.push(' '); |
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
let wQ = [0, 5]; | |
let bQ = [5, 0]; | |
let board = [ | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0], |
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
{ | |
metadata: { | |
core: { | |
name: "ISR Coverage", | |
uid: "7c2f79e7-2653-4adb-9e18-270761b3a0b1", | |
version: 1, | |
type: "tool", | |
}, | |
api: { | |
method: "post", |