Skip to content

Instantly share code, notes, and snippets.

@qqqrppp
Created April 3, 2019 13:08
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 qqqrppp/4dbb9eeb979610c6a96a2c85c243387e to your computer and use it in GitHub Desktop.
Save qqqrppp/4dbb9eeb979610c6a96a2c85c243387e to your computer and use it in GitHub Desktop.
parse text
const words = {}
const text = document.querySelector('body')
text.textContent
.trim()
.split(/\s/)
.filter(x => !~x.search(/[\d\W\s]/))
.forEach(word => words[word] = word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment