Skip to content

Instantly share code, notes, and snippets.

@marcmartino
Created July 27, 2017 19:07
Show Gist options
  • Save marcmartino/7b40c29068056d49c10c8df16ad0f99c to your computer and use it in GitHub Desktop.
Save marcmartino/7b40c29068056d49c10c8df16ad0f99c to your computer and use it in GitHub Desktop.
// 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