What is the method to capitalize the initial letter of a string in JavaScript?

I need assistance with capitalizing the first character of a string, but only if it is an alphabetic letter. I want to ensure that the remaining characters remain unchanged. Here are some examples of what I’m trying to achieve:

  • For the input “this is a test”, I expect the output to be “This is a test”.
  • Given “the Eiffel Tower”, the result should be “The Eiffel Tower”.
  • For “/index.html”, it should remain “/index.html”.