Skip to content

Instantly share code, notes, and snippets.

@slofurno
Created April 19, 2017 13:40
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 slofurno/951559bbc266790cd5b7838eb4b133ad to your computer and use it in GitHub Desktop.
Save slofurno/951559bbc266790cd5b7838eb4b133ad to your computer and use it in GitHub Desktop.
function counts(n) {
var s = '1'
for(var i = 0; i < n; i++) {
s = s.match(/(\d)(\1)*/g).map(x => x.length + x[0]).join('')
}
return s
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment