Learning JavaScript? Download my free JavaScript Handbook 🔥

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"]

Edit this page


Here's my latest YouTube video. I talk about why I think that dogs are a great help for developers working remotely: