Is there a javascript equivalent of python's __getattr__ method?
<p>In python you can define a object having <code>__getattr__(self,key)</code> method to handle all unknown attributes to be solvable in programmatic manner, but in javascript you can only define getters and setters for pre-defined attributes. Is there a generic way of getting the former thing done also in javascript?</p>

<p>Sample code would be smth like:</p>

<pre><code>function X() {};
X.prototype={
  __getattr__:function(attrname) {
    return "Value for attribute '"+attrname+"'";
  }
}

x=new X()
alert(x.lskdjoau); // produces message: "Value of attribute 'lskdjoau'"
</code></pre>

<p>Key point is getting value of attribute programmatically depending on the name of the attribute. Pre-setting attribute does not help because during init there is no information what attributes might be requested.</p>
