title: When is a property created on the current object VS a prototype?
body: <p>I was reading Google's <a href="https://developers.google.com/speed/articles/optimizing-javascript" rel="nofollow">JS optimization page</a>, and got to this section:</p>
  
  <blockquote>
    <p>Place instance variable declaration/initialization on the prototype for instance variables with value type... This avoids unnecessarily running the initialization code each time the constructor is called.</p>
  </blockquote>
  
  <p>I thought, "wait, then you can't change the values in your instance"</p>
  
  <p>But turns out you can, and that surprised me.</p>
  
  <p>Why, when you change a value provided to you by a prototype, does it get set on the object itself?</p>
  
  <pre><code>x = { one: 1 }
  y = Object.create(x)
  y.one // 1, of course
  y.one++;
  y.one // 2
  x.one // 1! why isn't this 2?
  </code></pre>
  
  <p><strong>What is the rule that defines this behavior?</strong></p>
  
  <p>Is it that a Left Hand Side lookup is always on the nearest object, but a Right Hand Side lookup will traverse the prototype chain?</p>
  
  <p>If so, this would apply to both reference and value types, but perhaps the temptation to mutate (<code>y.arr.push(1)</code>) would be too much, hence Google's recommendation to do this only for values?</p>