Back to Content

ErrorEvent: lineno property

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

latest445 B
Original Source

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

The lineno read-only property of the {{domxref("ErrorEvent")}} interface returns an integer containing the line number of the script file on which the error occurred.

Value

An integer.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}