Javascript String Immutability
Nothing is true, everything is permitted.
[Javascript String Immutability
This blog discusses String immutable property and covers a basic overview.medium.com](https://medium.com/@codesprintpro/javascript-string-immutability-ead81df30693 "https://medium.com/@codesprintpro/javascript-string-immutability-ead81df30693")
let str = "hello world";
str[0] = 'H';
console.log(str); // 還是會印出 hello world,而不是 Hello world
let str = "hello world";
str = `${str[0].toUpperCase()}${str.slice(1)}`; //重新製作字串
console.log(str); // 這樣才會是 Hello world