Implement a function called capitalizeWord(word)
that capitalizes the first letter of the input string word
and returns the capitalized string.
- The function should return a new string with the first letter capitalized.
- If the input is an empty string, return an empty string.
- The input will always be a string consisting of one word, and will not contain numbers or special characters.
- Transform only the first character, leaving the rest unchanged.
capitaliseWord('hello'); // Output: 'Hello'
capitaliseWord('mom'); // Output: 'Mom'
capitaliseWord('dAD'); // Output: 'DAD'
- Use the
toUpperCase
method.