Answered by : jthayil
{"tags":[{"tag":"textarea","content":"function sentence(s){\n return s.replace(\/^.{1}\/g, s[0].toUpperCase());\n}","code_language":"javascript"}]}
Source : | Last Update : Wed, 08 Feb 23
Answered by : afzal-afzal
function capFirst(str) { return str[0].toUpperCase() + str.slice(1); }
console.log(capFirst('hello'));
//output
//Hello
Source : https://www.freecodecamp.org/news/javascript-tolowercase-how-to-convert-a-string-to-lowercase-and-uppercase-in-js/ | Last Update : Fri, 18 Nov 22
Answered by : xerothermic-xenomorph-wa03p7gj567j
function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1);
}
console.log(capitalizeFirstLetter('foo')); // Foo
Source : https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript | Last Update : Mon, 07 Sep 20
Answered by : you
function capitalizeFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1);
}
// Example usage
const text = "hello world";
const capitalizedText = capitalizeFirstLetter(text);
console.log(capitalizedText); // Output: "Hello world"
Source : | Last Update : Tue, 19 Sep 23
Answered by : combative-crayfish-xu4hmew3x5l9
function capitalizeFirstLetter(name) { return name.replace(/^./, name[0].toUpperCase())
}
Source : | Last Update : Wed, 28 Apr 21
Answered by : kazi-mahbubur-rahman
const lower = 'this is an entirely lowercase string';
const upper = lower.charAt(0).toUpperCase() + lower.substring(1);
Source : | Last Update : Wed, 27 Jul 22
Answered by : praise-owode
var name = prompt("What is your name");
firstLetterUpper = name.slice(0,1).toUpperCase();
alert("Hello " + firstLetterUpper + name.slice(1, name.length).toLowerCase());
Source : | Last Update : Mon, 17 Oct 22
Answered by : grieving-gharial-54afdxs4rdwl
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1);
}
Source : https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript | Last Update : Mon, 02 Aug 21
Answered by : sergey-dragoner
const upperCase = function(names){ const toLower = names.toLowerCase().split(' '); const namesUpper = []; for(const wordName of toLower){ namesUpper.push(wordName[0].toUpperCase() + wordName.slice(1)); } return namesUpper.join(' ');
}
Source : | Last Update : Thu, 07 Jan 21