![blog 7 image](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fblog7.179cb565.jpg&w=3840&q=75)
Capitalise the first character of a word
1 min read
Prequisite:
JavascriptTypescript
- Basic understand of JavaScript and functions
- At least some basic understanding of typescript types
There are some occasions when we will need to capitalise on the first character of a word. Mostly, capitalising names is the most commonly used. But regardless of what your reason is, here is a simple re-usable function that will do just that.
function capitaliseString(string: string) {return string.charAt(0).toUpperCase() + string.slice(1); };