본문 바로가기

코딩/Javascript

자바스크립트 - String 대문자 & 소문자로 변환하기 (toUpperCase() & toLowerCase() 함수)

반응형

대문자로 변환하기

const str = 'hello WORLD';
console.log(str); // hello WORLD
console.log(str.toUpperCase()); // HELLO WORLD

toUpperCase() 함수를 사용하여, String 전체를 대문자로 변환.

 

 

소문자로 변환하기

const str = 'hello WORLD';
console.log(str); // hello WORLD
console.log(str.toLowerCase()); // hello world

toLowerCase() 함수를 사용하여, String 전체를 소문자로 변환.

반응형