Split string by every new instance of a letter

  javascript

Couldn’t find anything while searching but I need to split a string by each new instance of a letter. I know split() would output: (M,B,A,M,M,D,X,X,M,M,M,G,G,M,M,Z) but can’t figure out how to group them.

Exmaple: "MBAMMDXXMMMGGMMZ" should output to:
M
B
A
MM
D
XX
MMM
GG
MM
Z

str = "MBAMMDXXMMMGGMMZ"

newStr = str.split("")
console.log(newStr)

Source: Ask Javascript Questions

LEAVE A COMMENT