Today we discuss Capitalize
If you need to make first character in a string uppercase, that’s the challenge you look for.
Let’s have a look 👀
Since TypeScript 4.1 we have type aliases
Knowing how to iterate over a string let’s find first element and make it uppercase:
First, made it uppercase with type alias
Uppercase. In case of empty string we return itself without any update.
Tests and examples are available in Playground
Have a wonderful Friday 🔥typescriptmedium