IT
[javascript]JavaScript에서 문자열 대문자의 첫 글자를 어떻게 만드나요?
JavaScript에서 문자열 대문자의 첫 글자를 어떻게 만드나요? 질문 문자열의 첫 번째 문자를 어떻게 만드는 것이 아니라 다른 문자의 경우를 변경하지 않습니까?예를 들어: "this is a test" → "This is a test" "the Eiffel Tower" → "The Eiffel Tower" "/index.html" → "/index.html" 답변 기본 솔루션은 다음과 같습니다.기능 CapitalizeFirstletter (String) { string.charat (0) .toUpperCase () + string.slice (1); } console.log (CapitalizeFirstletter ( 'foo'));// foo.다른 답변은 String.prototype (이 답변도..
2022. 3. 29. 11:03
최근댓글