MENU

【JavaScript初学者】大文字と小文字を変換する方法

 
大文字に変換するにはtoUpperCase 小文字を変換するにはtoLowerCaseを使用します。  

大文字と小文字を変換する方法

書き方

toUpperCase()   //大文字に変換
toLowerCase()   //小文字に変換

 

使い方

>main.js

{
 const name = 'tanaka';
 const name2 = 'TANAKA';

 console.log(name.toUpperCase());
 console.log(name.toLowerCase());
}

結果

>TANAKA
>tanaka

 

 

 
 
未経験からエンジニアを目指すなら↓