Back to Content

ErrorEvent: message property

files/en-us/web/api/errorevent/message/index.md

latest428 B
Original Source

{{APIRef("HTML DOM")}}{{AvailableInWorkers}}

The message read-only property of the {{domxref("ErrorEvent")}} interface returns a string containing a human-readable error message describing the problem.

Value

A string.

Examples

js
window.addEventListener("error", (ev) => {
  console.log(`The error message: ${ev.message}`);
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}