title: Inheriting from the Error object - where is the message property?
body: <p>I noticed a strange behavior while defining custom error objects in Javascript:</p>
  
  <pre><code>function MyError(msg) {
      Error.call(this, msg);
      this.name = "MyError";
  }
  MyError.prototype.__proto__ = Error.prototype;
  
  var error = new Error("message");
  error.message; // "message"
  
  var myError = new MyError("message");
  myError instanceof Error; // true
  myError.message; // "" !
  </code></pre>
  
  <p>Why does <code>new Error("message")</code> set the <code>message</code> property, while <code>Error.call(this, msg);</code> does not? Sure, I can just define <code>this.message = msg</code> in the <code>MyError</code> constructor, but I don't quite understand why it is not already set in the first place.</p>