TIL: convert a string into an array of words in JS
Sometimes it's nice to document the little wins. Today, I learned this useful bit of code to parse a string into an array of words, while removing punctuation.
text.replace(/\p{P}/gu, "").split(" "))
To break this down:
text: the string to parse
.re...
blog.kellenbaker.com1 min read
Developer Avocado
Frontend developer. Debugging this world one console.log() at a time
Thanks for sharing ! 👏