This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.


La propietat lineNumber conté el nombre de la línia del fitxer que ha llençat aquest erro.


Exemple: Utilitzar lineNumber

var e = new Error('No he pogut interpretar l\'entrada');
throw e;
console.log(e.lineNumber) // 2

Exemple: Exemple alternatiu usant l'event error

window.addEventListener('error', function(e) {
  console.log(e.lineno); // 5
var e = new Error('No he pogut interpretar l\'entrada');
throw e;

Això és standard i suportat per Chrome, Firefox i provablement altres.


No forma part de cap especificació. No és standard.

Compatibilitat amb navegadors

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic On error object in handled errors (Yes) No support No support No support
Característica Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic No support No support (Yes) No support No support No support

Vegeu també

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, teoli, enTropy
Last updated by: mdnwebdocs-bot,