diff options
Diffstat (limited to 'files/es/web/javascript/reference/global_objects/error/linenumber')
| -rw-r--r-- | files/es/web/javascript/reference/global_objects/error/linenumber/index.html | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/files/es/web/javascript/reference/global_objects/error/linenumber/index.html b/files/es/web/javascript/reference/global_objects/error/linenumber/index.html new file mode 100644 index 0000000000..0efec0696f --- /dev/null +++ b/files/es/web/javascript/reference/global_objects/error/linenumber/index.html @@ -0,0 +1,101 @@ +--- +title: Error.prototype.lineNumber +slug: Web/JavaScript/Referencia/Objetos_globales/Error/lineNumber +translation_of: Web/JavaScript/Reference/Global_Objects/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> |
