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 isPalindrome(n) { | |
| var str, firstDigit, lastDigit; | |
| str = String(n).replace(".", "").split(""); | |
| if (str.length < 2) { | |
| return false; | |
| } | |
| firstDigit = str.shift(); |
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(dividend, divisor) { | |
| return dividend % divisor === 0; | |
| } | |
| function isPrime(n) { | |
| var factor = 2; | |
| n = Math.abs(n); | |
| if (n <= 1) { |
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 factorial(n) { | |
| return n < 2 ? 1 : n * factorial(n - 1); | |
| }; | |
| var fastFac = (function () { | |
| var memo = {}; | |
| return function (n) { | |
| if (memo[n]) { | |
| return memo[n]; |
NewerOlder