Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Error.prototype.lineNumber

Non-standard
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.

Resum

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

Exemples

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.

Especificacions

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

Compatibilitat amb navegadors

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic On error object in handled errors (Yes) Not supported Not supported Not supported
Característica Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic Not supported Not supported (Yes) Not supported Not supported Not supported

Vegeu també

Document Tags and Contributors

 Contributors to this page: teoli, enTropy
 Last updated by: teoli,