Answered by : helpless-horse-4lzvq6vxfx8c
const lower = 'this is an entirely lowercase string';
const upper = lower.charAt(0).toUpperCase() + lower.substring(1);
Source : | Last Update : Wed, 11 Mar 20
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 : quinten
const string = "tHIS STRING'S CAPITALISATION WILL BE FIXED."
const string = string.charAt(0).toUpperCase() + string.slice(1)
Source : | Last Update : Thu, 10 Sep 20
Answered by : tamer-jarrar
function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1);
}
Source : | Last Update : Wed, 28 Sep 22
Answered by : itsmycode
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
Source : https://itsmycode.com/capitalize-the-first-letter-of-string-using-javascript/ | Last Update : Tue, 11 Jan 22
Answered by : mangaliso-earnshaw
// this will only capitalize the first word
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 May 21
Answered by : shy-stoat-eobfmwe4a400
function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1);
}
console.log(capitalizeFirstLetter('foo')); // Foo Run code snippet
Source : https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript | Last Update : Wed, 02 Mar 22
Answered by : tanner-kopel
let val = ' this is test ';
val = val.trim();
val = val.charAt(0).toUpperCase() + val.slice(1);
console.log("Value => ", val);
Source : https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript | Last Update : Thu, 23 Sep 21
Answered by : muhammad-hashim
function capitalize(word) { return word.charAt(0).toUpperCase() + word.toLocaleLowerCase().substring(1)
}
capitalize("bob");
Source : | Last Update : Sun, 20 Jun 21
Answered by : you
function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1);
}
// Example usage
const originalString = 'hello world';
const capitalizedString = capitalizeFirstLetter(originalString);
console.log(capitalizedString); // Output: "Hello world"
Source : | Last Update : Tue, 19 Sep 23