const text = 'helloThereMister'; const result = text.replace(/([A-Z])/g, " $1"); const finalResult = result.charAt(0).toUpperCase() + result.slice(1); console.log(finalResult);
capitalize the first letter – as an example. Note the space in
Of course, in case the first letter is already capital – you would have a spare space to remove.
Answered By – ZenMaster
Answer Checked By – Clifford M. (BugsFixing Volunteer)