Last active
February 24, 2021 12:04
-
-
Save tokdaniel/5fd150ab1acd6b354a225e4c9723bf00 to your computer and use it in GitHub Desktop.
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
const range = (m: number, n: number): number[] => Array.from(Array(n - m + 1).keys()).map(n => n + m) | |
const isEvil = (n: number): boolean => ( | |
n.toString(2).split('').filter((x) => x === '1').length % 2 == 0 | |
) | |
range(0, 50).filter(isEvil) | |
console.log(range(0,50).filter(isEvil).join('\n')) | |
// Compiled | |
const range = (m, n) => Array.from(Array(n - m + 1).keys()).map(n => n + m); | |
const isEvil = (n) => (n.toString(2).split('').filter((x) => x === '1').length % 2 == 0); | |
range(0, 50).filter(isEvil); | |
console.log(range(0, 50).filter(isEvil).join('\n')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment