For making the first letter of a string uppercase in JavaScript you can use String.charAt()and in the argument of the function, you will pass an index of the string that you want to make capital. Below is the code for the same:-
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
If you are passionate to pursue a career in Web Development, you can take up Web Development Online Courses by Intellipaat!