Created
July 27, 2017 19:07
-
-
Save marcmartino/7b40c29068056d49c10c8df16ad0f99c to your computer and use it in GitHub Desktop.
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
// 1..100 | |
// 3 5 | |
const seq = min => max => { | |
let list = []; | |
for (let index = min; index <= max; index++) { | |
list.push(index); | |
} | |
return list; | |
} | |
seq(1)(100) | |
.map(num => { | |
var newOutput = ''; | |
if (num % 3 === 0) { | |
newOutput += 'Marc'; | |
} | |
if (num % 5 === 0){ | |
newOutput += (newOutput.length ? ' ' : '') + 'Martino'; | |
} | |
return newOutput || num; | |
}).forEach(val => console.log(val)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment