You are absolutely right, it is possible to use a RegExp to achieve a similar result without having to use the Symbol.split.
The article is more focused on what the Symbol.split is, and one of its use-case.
If you ask me, I would be more confortable using something more explicit (maybe a third-party library full of splitters?) than using a RegExp (directly).
As a matter of fact, while writing this article, I didn't even knew there was a RegExp for that but the community is full of wonderful and clever people, including someone in the comment section that helped me enhance this article with a RegExp-based solution!
RegExp are still very obscur for most of us and using something explicit and declarative is for sure an added argument for using a splitter and this symbol.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Adam and thanks for your reply.
You are absolutely right, it is possible to use a RegExp to achieve a similar result without having to use the
Symbol.split
.The article is more focused on what the
Symbol.split
is, and one of its use-case.If you ask me, I would be more confortable using something more explicit (maybe a third-party library full of splitters?) than using a RegExp (directly).
As a matter of fact, while writing this article, I didn't even knew there was a RegExp for that but the community is full of wonderful and clever people, including someone in the comment section that helped me enhance this article with a RegExp-based solution!
RegExp are still very obscur for most of us and using something explicit and declarative is for sure an added argument for using a splitter and this symbol.