如何在 JavaScript 中使字符串的第一个字母成为大写?

How do I make the first letter of a string uppercase, but not change the case of any of the other letters?

For example:

  • "this is a test" -> "This is a test"
  • "the Eiffel Tower" -> "The Eiffel Tower"
  • "/index.html" -> "/index.html"

转载于:https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript