title: Why doesn't the null-terminator placed arbitrarily in a string terminate it?
body: <p>The null character or null-terminator (<code>\0</code>) is to be used to terminate a contiguous sequence of characters. I find that in C, I can add the character into a string at a random position and the string will be cut off from that point. For example:</p>
  
  <pre><code>char * s = "Hello\0World";
  </code></pre>
  
  <p>will result in <code>s</code> being equal to the string <code>"Hello"</code>. In JavaScript, however, this is not the case:</p>
  
  <pre><code>var s = "Hello\0World";
  </code></pre>
  
  <p>The above won't work as expected. <code>s</code> will be equal to the string <code>"HelloWorld"</code>.</p>
  
  <p>Why doesn't this work?</p>