cipher当我尝试更改指定索引处的字符串字符时,我从变量中收到此警告。
const emojis: string[] = [/* values */];
function revealOriginEmojis(cipher: string): string {
for(let i = 0; i < cipher.length; i++){
let index: number = emojis.indexOf(cipher[i]);
cipher[i] = emojis[index];
}
return cipher;
}
Run Code Online (Sandbox Code Playgroud)
那么,我应该创建一个新的字符串变量还是任何更好的解决方案?非常感谢
typescript ×1