Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
message は Error インスタンスのデータプロパティで、人間が読めるエラーの説明です。
文字列で、Error() コンストラクターの最初の引数として渡された値に対応します。
| 書込可能 | 可 |
| 列挙可能 | 不可 |
| 設定可能 | 可 |
このプロパティは、利用可能または設定されている場合、エラーの簡潔な説明を含みます。 message プロパティは name プロパティとの組み合わせで、Error の文字列表現を生成するために Error.prototype.toString() メソッドにより使用されます。
既定で message プロパティは空文字列ですが、この振る舞いは、 Error コンストラクターの第一引数としてメッセージを指定することにより、インスタンスを上書きできます。
| ECMAScript® 2027 Language Specification # sec-error.prototype.message |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年10月6日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.