blob: 284aad63d2167f5edf0d350b08b708d47e3b6da2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
---
title: Error.prototype.lineNumber
slug: Web/JavaScript/Reference/Global_Objects/Error/lineNumber
translation_of: Web/JavaScript/Reference/Global_Objects/Error/lineNumber
original_slug: Web/JavaScript/Referencia/Objetos_globales/Error/lineNumber
---
<div>No es una norma<br>
Esta característica no es una norma y no está en la lista de normas. No la utilice en sitios de producción que enfrenta la Web: no va a funcionar para todos los usuarios. También puede haber grandes incompatibilidades entre implementaciones y el comportamiento puede cambiar en el futuro.</div>
<div> </div>
<div>La propiedad <strong>lineNumber </strong>contiene el número de linea en el archivo que arrojó el error.</div>
<div> </div>
<h2 id="Ejemplos">Ejemplos</h2>
<h3 id="Utilizando_lineNumber">Utilizando <code>lineNumber</code></h3>
<pre class="brush: js">var e = new Error('No fue posible analizar el dato introducido');
throw e;
console.log(e.lineNumber) // 2
</pre>
<h3 id="Ejemplo_alternativo_utilizando_el_evento_'error'">Ejemplo alternativo utilizando el evento '<code>error'</code></h3>
<pre class="brush: js">window.addEventListener('error', function(e) {
console.log(e.lineno); // 5
});
var e = new Error('No fue posible analizar el dato introducido');
throw e;
</pre>
<p>Esta es una norma soportada por Chrome, Firefox entre otros.</p>
<h2 id="Especificaciones">Especificaciones</h2>
<p>No forma parte de ninguna especificación. No es una norma.</p>
<h2 id="Navegadores_compatibles">Navegadores compatibles</h2>
<div>
<p> </p>
<p>Tabla de compatibilidad</p>
<table class="compat-table" style="line-height: 1.5;">
<tbody>
<tr>
<th>Caracteristica</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Soporte básico</td>
<td>Compatible [1]</td>
<td>Compatible</td>
<td>No compatible</td>
<td>No compatible</td>
<td>No compatible</td>
</tr>
</tbody>
</table>
<p> [1] Objeto error en errores manejados.</p>
<table class="compat-table" style="line-height: 1.5;">
<tbody>
<tr>
<th>Caracteristica</th>
<th>Android</th>
<th>Chorme para Android</th>
<th>Firefox Móvil (Gecko)</th>
<th>IE Móvil</th>
<th>Opera Móvil</th>
<th>Safari Móvil</th>
</tr>
<tr>
<td>Soporte básico</td>
<td>No compatible</td>
<td>No compatible</td>
<td>Compatible</td>
<td>No compatible</td>
<td>No compatible</td>
<td>No compatible</td>
</tr>
</tbody>
</table>
</div>
<h2 id="sect1"> </h2>
<h2 id="Vea_también">Vea también:</h2>
<ul>
<li>{{jsxref("Error.prototype.stack")}} {{non-standard_inline}}</li>
<li>{{jsxref("Error.prototype.columnNumber")}} {{non-standard_inline}}</li>
<li>{{jsxref("Error.prototype.fileName")}} {{non-standard_inline}}</li>
</ul>
|