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
function wisePerson(wiseType, whatToSay) { | |
let quote = 'A wise ' + wiseType + ' once said: "' + whatToSay + '."'; | |
return quote; | |
} | |
/* From here down, you are not expected to | |
understand.... for now :) | |
Nothing to see here! |
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
function shouter(whatToShout) { | |
let shout = whatToShout.toUpperCase(); | |
shout = shout + '!!!'; | |
return shout; | |
} | |
let whatToShout = ('as you can hear i am whispering'); | |
console.log(shouter(whatToShout)); | |
function testShouter() { |
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
function textNormalizer(text) { | |
let normal = text.toLowerCase(); | |
normal = normal.trim(); | |
return normal; | |
} | |
let text = " let's GO SURFING NOW everyone is learning how "; | |
console.log(textNormalizer(text)); | |
function testTextNormalizer() { |
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
function computeArea(width, height) { | |
let area = width*height; | |
return area | |
} | |
let width = 3; | |
let height = 4; | |
console.log(computeArea(width,height)); | |
function testComputeArea() { |
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
function celsToFahr(celsTemp) { | |
let fahrenheit = (celsTemp * 9/5) + 32; | |
return fahrenheit; | |
} | |
function fahrToCels(fahrTemp) { | |
let celsius = (fahrTemp - 32)*(5/9); | |
return celsius; | |
} |
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
function isDivisible(dividend, divisor) { | |
let rem = dividend % divisor; | |
let divisible = false; | |
if (rem === 0) { | |
divisible = true; | |
} | |
return divisible; | |
} | |
let dividend = 18; |
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
function max(numbers) { | |
let maxnum = 0; | |
for (i = 0; i <= numbers.length; i++) { | |
if (maxnum < numbers[i]) { | |
maxnum = numbers[i]; | |
} | |
} | |
if (numbers.length === 0) { | |
return null; | |
} |
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
function average(numbers) { | |
let sum = numbers[0]; | |
for (i=1; i<numbers.length; i++) { | |
sum += numbers[i]; | |
} | |
let average = sum / numbers.length; | |
return average; | |
} | |
/* From here down, you are not expected to |
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
function fizzBuzz(countTo) { | |
let arr = []; | |
for (i=1;i<=countTo;i++) { | |
if (i%3==0 && i%5==0){ | |
arr[i] = 'fizzbuzz'; | |
} | |
else if (i%3==0) { | |
arr[i] = 'fizz'; | |
} | |
else if (i%5==0) { |
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
function main() { | |
try { | |
doAllTheThings(); | |
} | |
catch(FatalException) { | |
console.log('Caught FatalException '+FatalException); | |
reportError(FatalException); | |
} | |
} |
OlderNewer