[LeetCode] To Lower Case

준규·2022년 12월 30일
0

1.문제


Given a string s, return the string after replacing every uppercase letter with the same lowercase letter.


문자열 s가 주어질 때 모든 문자가 소문자인 s를 리턴하는 문제이다.


Example 1

Input: s = "Hello"
Output: "hello"

Example 2

Input: s = "here"
Output: "here"

Example 3

Input: s = "LOVELY"
Output: "lovely"

Constraints:

  • 1 <= s.length <= 100
  • s consists of printable ASCII characters.

2.풀이

  1. 모든 문자를 소문자로 바꿔서 리턴해준다.

/**
 * @param {string} s
 * @return {string}
 */
const toLowerCase = function (s) {
  return s.toLowerCase();
};

3.결과

profile
안녕하세요 :)

0개의 댓글