Skip to content

Instantly share code, notes, and snippets.

@schabluk
Created February 9, 2019 14:05
Show Gist options
  • Save schabluk/4abcb81f887b88aa6514f8ae08d0b6c8 to your computer and use it in GitHub Desktop.
Save schabluk/4abcb81f887b88aa6514f8ae08d0b6c8 to your computer and use it in GitHub Desktop.
Alphanumeric Sequences
const f = (a, b) => [].concat(...a.map(d => b.map(e => [].concat(d, e))))
const cartesian = (a, b, ...c) => (b ? cartesian(f(a, b), ...c) : a)
const letters = Array.from({ length: 26 }, (k, v) => String.fromCharCode(v + 65))
const numbers = Array.from({ length: 9 }, (k, v) => v)
console.log(cartesian(letters, numbers))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment