accessing an inner variable in a javascript object
<p>Consider this errorful code:</p>

<pre><code>x = {
  y : "why",
  z : function() {
    return y + " zed";
  }
}
</code></pre>

<p>The function z does not work: "ReferenceError: y is not defined".</p>

<p>Is there a way to access y from within the function z without fully specifying it as x.y?</p>

<p>I could of course rewrite this as </p>

<pre><code>x = function() {
  var self = this;
  this.y = "why";
  this.z = function() {
    return self.y + " zed";
  };
  return this;
}();
</code></pre>

<p>... but gosh.</p>
