JSFiddle - React, Tailwind, and code Playground
JavaScript
function Word (str) {
if (str.charAt(0) == 0) return str = "You can not enter empty string";
return str[0].toUpperCase() + str.slice(1);
}
var str = prompt ("Enter string ", "");
alert (Word(str));