Created
December 10, 2018 19:28
-
-
Save cmbuckley/0aafea096a0b27146893a611aa0ad0ba to your computer and use it in GitHub Desktop.
Code solution to output text for https://i.kym-cdn.com/photos/images/newsfeed/001/336/116/68b.jpg
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
function nestingLolz(count) { | |
return [...Array(count)].reduce(function (a, c, i) { | |
return a + ' or my ' + Array(i + 1).fill('son').join('’s '); | |
}, 'Don’t talk to me') + ' ever again'; | |
} | |
// haven't decided which I prefer :-) | |
function nestingLolzAlternate(count) { | |
return ['Don’t talk to me'] | |
.concat([...Array(count)].map((e, i) => Array(i + 1).fill('son').join('’s '))) | |
.join(' or my ') + ' ever again'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment