How to capitalize the first letter of string in JavaScript?

I have a JavaScript string containing a sentence. Is it possible to capitalize ONLY the first letter of it? Please let me know how to do it if possible.

Comments

  • It's been a long time, but I think it's something like

    string.charAt(0).toUpperCase() + string.substring(1);
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion