JS字符串常用方法(自)---6、字符串大小寫轉換
一、總結
一句話總結:
js字符串大小寫轉換方法有toLowerCase()和toUpperCase(),就是分別將字符串轉化成小寫和大寫
toLowerCase()
作用:將字符串轉化成小寫
參數:無
返回值:轉換成小寫的字符串
toUpperCase()
console.log('ABc'.toLowerCase());
console.log('ABc'.toUpperCase());
二、字符串大小寫轉換
博客對應課程的視頻位置:
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>toLowerCase()</title> 6 </head> 7 <body> 8 <!-- 9 toLowerCase() 10 作用:將字符串轉化成小寫 11 參數:無 12 返回值:轉換成小寫的字符串 13 14 toUpperCase() 15 16 17 --> 18 <script> 19 console.log('ABc'.toLowerCase()); 20 console.log('ABc'.toUpperCase()); 21 </script> 22 </body> 23 </html>
