W3cubDocs

/Web APIs

ErrorEvent: lineno property

Note: This feature is available in Web Workers.

The lineno read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.

Value

An integer.

Examples

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

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
lineno 10 12 27 11 6 18 27 11 6 1.0 4.4 6

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent/lineno