我不明白为什么 for 循环不修改字符串的字符。这是
function testing (str) {
let other_str = str
for (let i = 0; i < other_str.length; i++) {
other_str[i] = 'g'
}
return other_str;
console.log(testing('hey'));
我知道我可以使用其他方式,但我想了解这一点。
猛跑小猪
相关分类