Skip to content

Instantly share code, notes, and snippets.

@passcod
Created October 1, 2017 20:14
Show Gist options
  • Save passcod/fb05a4deee65837d474b460953e09098 to your computer and use it in GitHub Desktop.
Save passcod/fb05a4deee65837d474b460953e09098 to your computer and use it in GitHub Desktop.
const { permutation } = require('array-permutation')
const nouns = ['tucker', 'children', 'school', 'america', 'evil']
function verb (noun) {
return noun === 'children' ? 'are' : 'is'
}
function phrase ([ a, b, c, d, e ]) {
return `${a}: ${b} ${verb(b)} learning in ${c} that ${d} ${verb(d)} ${e}`
}
for (const perm of permutation(nouns)) {
console.log(phrase(perm))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment