The String split() method
By Flavio Copes
Learn how the JavaScript split() method breaks a string into an array of tokens every time it finds a separator pattern, with the case-sensitive match removed.
~~~
split() truncates a string when it finds a pattern (case sensitive), and returns an array with the tokens:
const phrase = 'I love my dog! Dogs are great'
const tokens = phrase.split('dog')
tokens //["I love my ", "! Dogs are great"] ~~~
Related posts about js: