I just learned that declaring a variable using 'const' doesn't mean it can't be altered, it just means that the variable can't be reassigned.
For example:
const arr = [];
arr.push(10) //Adds 10 to the arr without any problem, whereas
arr = [10] //Throws an error saying "TypeError: Assignment to constant variable."
----------------------------------------------|||||||||||||||||||||||---------------------------------------------------
And one more thing..... to convert "camelCase" to "Camel Case",
"const newText = string.replace(/([A-Z]+)/g, ' $1')
.replace(/^./, str => str.toUpperCase() )"
can be used instead of
"const newText = string
.replace(/([a-z])([A-Z])/g, "$1 $2")
.replace(/([A-Z])([a-z])/g, " $1$2")
.replace(/\ +/g, " ");
const nextString = newText[0].toUpperCase() + newText.slice(1);" to do the exact same thing.
Works for any type of string and that "+" after "[A-Z]" makes all the difference.