title: Javascript define a constant object property
body: <p>I wanted to have an object field that is immutable. I've tried: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const a = 1;
  var o = {
     x: 'This is mutable',
     y: a // This should not be mutable.
  };
  o.y = 'Changed';
  console.log(o);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Field <code>y</code> gets re-assigned.<br>
  Is there any way to make this work?</p>