how to get this on javascript? given a name with no spaces AndrewGonzalezPuerta
convert into this Andrew Gonzalez Puerta
Insert a space
before every capital letter not counting the first one
how to get this on javascript? given a name with no spaces AndrewGonzalezPuerta
convert into this Andrew Gonzalez Puerta
Insert a space
before every capital letter not counting the first one
Here's a regex solution using a lookahead to make sure that the capital letter is not at the beginning of the string.
const name = "AndrewGonzalezPuerta";
console.log(name.replace(/(?!^)([A-Z])/g, " $1"));