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 wisePerson(wiseType, whatToSay) { | |
| return `A wise ${wiseType} once said: "${whatToSay}".`; | |
| } | |
| // tests | |
| function testWisePerson() { | |
| const wiseType = 'goat'; |
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) { | |
| return `${whatToShout.toUpperCase()}!!!`; | |
| } | |
| /* From here down, you are not expected to | |
| understand.... for now :) | |
| Nothing to see here! | |
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 textNormalizer(text) { | |
| return `${text.toLowerCase().trim()}`; | |
| } | |
| /* From here down, you are not expected to | |
| understand.... for now :) | |
| Nothing to see here! | |
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 computeArea(width, height) { | |
| return width* height; | |
| } | |
| /* From here down, you are not expected to | |
| understand.... for now :) | |
| Nothing to see here! | |
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) { | |
| return celsTemp * 9/5 + 32; | |
| } | |
| function fahrToCels(fahrTemp) { | |
| return (fahrTemp - 32) * 5/9; | |
| } | |
| /* 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 isDivisible(divisee, divisor) { | |
| return divisee % divisor === 0; | |
| } | |
| /* From here down, you are not expected to | |
| understand.... for now :) | |
| Nothing to see here! | |
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 doTrafficLights() { | |
| const activeLight = getActiveLight(); | |
| if (activeLight === 'red') { | |
| turnRed(); | |
| } | |
| else if (activeLight === 'green') { | |
| turnGreen(); | |
| } | |
| else { | |
| turnYellow(); |
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(err) { | |
| console.error(err); | |
| reportError(err); | |
| } | |
| } |
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 addToList(list, item) { | |
| list.push(item); | |
| return list; | |
| } | |
| /* 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 findLength(array) { | |
| return array.length; | |
| } | |
| function accessLastItem(array) { | |
| return array[array.length - 1]; | |
| } | |
| /* In the 2nd function, why is the array before the [array.length - 1] necessary? |
OlderNewer