The main problem with adding space before a capital letter is that it can make the word look smaller than it should. This can be confusing for readers, and can also lead to mistakes being made when typing the word.
var str = "thisIsAString"; str = str.replace(/([A-Z])/g, ' $1'); console.log(str); // "this Is A String"
This code defines a string, then uses the replace() method to look for any uppercase letters in the string and adds a space before them. Finally, it prints the new string to the console.
What is Capital letter
Working with text
var sentence = “I am a sentence.”; sentence.replace(” “, ” “);
This will produce the following string: I am a sentence.