title: Immutability should throw error but it does not in string
body: <p>I am testing immutability of a string and wrote this function that takes in a String. </p>
  
  <p>Since a string is immutable, str[i] below, cannot be assigned to any value. </p>
  
  <p>However, when I run this function, it does not give me an error. Why is that? (as per my study, I believe this line (str[i] ='x' should break the system/stop executing the function and throw an error. But it does not (this is written in VSCode editor)</p>
  
  <pre><code>function tuc(str) {
          let res = [];
          for (let i = 0; i &lt; str.length; i++) {
              str[i]='x';
              let c = str[i];
              res.push(c.toUpperCase());
          }
          return res.join("");
      }
  </code></pre>