🏴
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 isPrime(num) { | |
for (let i = 2; i < num; i++) { | |
if (num % i === 0) { | |
return false; | |
} | |
} | |
} | |
function largestPrimeFactor(number) { | |
let factors = []; |
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 fiboEvenSum(n) { | |
let result = [1, 2]; | |
for (let i = 0; i < (n -1); i++) { | |
let sum = (result[result.length - 1] + result[result.length - 2]); | |
result.push(sum); | |
} | |
let counter = 0; | |
for (let num of result) { | |
num % 2 === 0 ? counter += num; | |
} |
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 multiplesOf3and5(number) { | |
let counter = 0; | |
for (let i = 0; i < number; i++) { | |
if (i % 3 === 0 || i % 5 === 0) { | |
counter += i; | |
} | |
} | |
return counter; | |
} |
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 randomNumber = Math.floor(Math.random() * 8); | |
let quote = ""; | |
switch(randomNumber) { | |
case 0: | |
quote = "<h1>You miss 100% of the shots you don't take</h1> <p>Wayne Gretzky</p>"; | |
break; | |
case 1: | |
quote = '<h1>Every time I practice, the luckier I get</h1> <p>Gary Player</p>'; |