function normalize(arr) {arr = arr.map((x)=>x.toLowerCase());arr = arr.map((x)=>{ console.log(typeof x[0]); x[0] = x[0]-32; //將首字符變大寫 console.log(x[0]);return x});return arr; }normalize(['adam', 'LISA', 'barT']).toString();C里經(jīng)常用S[0] = S[0] +/- 32來轉(zhuǎn)換大小寫。js似乎不行?
js字符串首字符無法用s[0]-32將小寫轉(zhuǎn)化為大寫?
哈士奇WWW
2019-03-13 14:15:25