Javascript – Split a string into an array of words and punctuation marks
I have a string: this.sentence = 'I have a brother, sister, a dog, and a cat.' I want to convert it into an array so that each word and each punctuation mark is a separate value. Using .split(" ") gives…