Skip to content

Instantly share code, notes, and snippets.

@cmbuckley
Created December 10, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmbuckley/0aafea096a0b27146893a611aa0ad0ba to your computer and use it in GitHub Desktop.
Save cmbuckley/0aafea096a0b27146893a611aa0ad0ba to your computer and use it in GitHub Desktop.
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