前提條件
概要
類型:實(shí)踐
難度:中等
任務(wù)描述
題 1:首字母改大寫(xiě)
編寫(xiě)函數(shù) firstLetterToUpperCase
,滿足
firstLetterToUpperCase('hello'); // 輸出 'Hello'
firstLetterToUpperCase('World'); // 輸出 'World'
firstLetterToUpperCase(345); // 輸出 345
題 2:去字符串頭尾空格
編寫(xiě)函數(shù) trim
,滿足
trim(' abc '); // 輸出 'abc'
trim(' a bc '); // 輸出 'a bc'
題 3:刪除字符串中所有的數(shù)字
編寫(xiě)函數(shù) removeNum
,滿足
removeNum('a23b434c45'); // 輸出 'abc'
removeNum('343abd8c'); // 輸出 'abdc'
題 4: 反轉(zhuǎn)字符串
編寫(xiě)函數(shù) reverse
,滿足
reverse('abcd'); // 輸出 'dbca'
reverse('a'); // 輸出 'a'