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 : 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 : 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 : helpless-hamster-iyyzaozffwgx
>>> "hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
Source : https://stackoverflow.com/questions/1549641/how-can-i-capitalize-the-first-letter-of-each-word-in-a-string | Last Update : Tue, 28 Jun 22
Answered by : friendly-ferret-3liqcxrky19d
var str = "hello world";
str = str.toLowerCase().replace(/\b[a-z]/g, function(letter) { return letter.toUpperCase();
});
alert(str); //Displays "Hello World"
Source : https://stackoverflow.com/questions/5122402/uppercase-first-letter-of-variable | Last Update : Mon, 04 Oct 21
Answered by : rodrigo-a-f-garcia
const names = ["alice", "bob", "charlie", "danielle"];
const namesCap = names.map((name) => { return `${name[0].toUpperCase()}${name.slice(1)}`;
});
console.log(namesCap);
Source : https://www.ingroy.com | Last Update : Wed, 13 Apr 22
Answered by : md-razzak
// name er first letter uppercase
let name = "aminul islam rasel" //Aminul Islam Rasel let word = name.split(" ") // create array each word word[0] = word[0].charAt(0).toUpperCase() + word[0].slice(1) word[1] = word[1].charAt(0).toUpperCase() + word[1].slice(1) word[2] = word[2].charAt(0).toUpperCase() + word[2].slice(1) name = word.join(" ")// get Aminul Islam Rasel console.log(name);//show console
// array map method use kore let name = "abdur razzak hassan tusher mafus ulla" let word = name.split(" ") word = word.map(function (value) { return value.charAt(0).toUpperCase() + value.slice(1) }) name = word.join(" ") console.log(name);
Source : | Last Update : Mon, 18 Apr 22
Answered by : doubtful-dogfish-afpaozrlqjc7
string.charAt(index)
Source : https://flexiple.com/javascript-capitalize-first-letter/ | Last Update : Tue, 26 Oct 21