Last active
January 3, 2020 16:35
-
-
Save jfrites/6408fd6ea5cfe12418db2b7490eb7731 to your computer and use it in GitHub Desktop.
Problem Set
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
//Do You Play The Theremin | |
let doYouPlayTheTheremin = (name) => { | |
if (name.charAt(0) === | |
's' || name.charAt(0) === | |
'S') { | |
return true; | |
} else; | |
return false; | |
}; | |
console.log(doYouPlayTheTheremin("Frank")); | |
console.log(doYouPlayTheTheremin("Sean")); | |
//Last Character | |
let lastCharacter = (name1, name2) => { | |
if (name1.charAt(name1.length-1) === | |
name2.charAt(name2.length-1)) { | |
return true; | |
} else; | |
return false; | |
}; | |
console.log(lastCharacter("Frank", "Kevin")); | |
console.log(lastCharacter("Sean", "Ian")); | |
//maxOfThree | |
const maxOfThree = (num1, num2, num3) => { | |
if (num1 > num2 && num1 > num3) return num1; | |
if (num2 > num1 && num2 > num3) return num2; | |
if (num3 > num1 && num3 > num2) return num3; | |
} | |
console.log(maxOfThree(6, 2, 3)); | |
//everywhichway | |
const everyWhichWay = (numOne, numTwo, numThree) => { | |
if (numOne + numTwo === numThree) { | |
return "Sum"; | |
} else if (numOne - numTwo === numThree) { | |
return "Difference"; | |
} else if (numOne * numTwo === numThree) { | |
return "Product"; | |
} else if (numOne / numTwo === numThree) { | |
return "fraction"; | |
} else { | |
return "null"; | |
} | |
} | |
console.log(everyWhichWay(10,20,30)); | |
console.log(everyWhichWay(50, 20, 30)); | |
console.log(everyWhichWay(4, 4, 16)); | |
console.log(everyWhichWay(100, 10, 10)); | |
console.log(everyWhichWay(1, 1000, 50)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment