aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/javascript/reference/global_objects/error/linenumber
diff options
context:
space:
mode:
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/error/linenumber')
-rw-r--r--files/ca/web/javascript/reference/global_objects/error/linenumber/index.html94
1 files changed, 94 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/error/linenumber/index.html b/files/ca/web/javascript/reference/global_objects/error/linenumber/index.html
new file mode 100644
index 0000000000..7b85f29c19
--- /dev/null
+++ b/files/ca/web/javascript/reference/global_objects/error/linenumber/index.html
@@ -0,0 +1,94 @@
+---
+title: Error.prototype.lineNumber
+slug: Web/JavaScript/Referencia/Objectes_globals/Error/lineNumber
+translation_of: Web/JavaScript/Reference/Global_Objects/Error/lineNumber
+---
+<div>{{JSRef("Global_Objects", "Error", "EvalError,InternalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError")}} {{non-standard_header}}</div>
+
+<h2 id="Summary" name="Summary">Resum</h2>
+
+<p>La propietat <code><strong>lineNumber</strong></code> conté el nombre de la línia del fitxer que ha llençat aquest erro.</p>
+
+<h2 id="Examples" name="Examples">Exemples</h2>
+
+<h3 id="Example:_Throwing_a_custom_error" name="Example:_Throwing_a_custom_error">Exemple: Utilitzar <code>lineNumber</code></h3>
+
+<pre class="brush: js">var e = new Error('No he pogut interpretar l\'entrada');
+throw e;
+console.log(e.lineNumber) // 2
+</pre>
+
+<h3 id="Example:_Alternative_example_using_error_event" name="Example:_Alternative_example_using_error_event">Exemple: Exemple alternatiu usant l'event <code>error</code></h3>
+
+<pre class="brush: js">window.addEventListener('error', function(e) {
+ console.log(e.lineno); // 5
+});
+var e = new Error('No he pogut interpretar l\'entrada');
+throw e;
+</pre>
+
+<p>Això és standard i suportat per Chrome, Firefox i provablement altres.</p>
+
+<h2 id="Especificacions">Especificacions</h2>
+
+<p>No forma part de cap especificació. No és standard.</p>
+
+<h2 id="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Suport bàsic</td>
+ <td>On <code>error</code> object in handled errors</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Suport bàsic</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also" name="See_also">Vegeu també</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>