aboutsummaryrefslogtreecommitdiff
path: root/files/ar/web/javascript/reference/errors
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
commit4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch)
treed4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/ar/web/javascript/reference/errors
parent33058f2b292b3a581333bdfb21b8f671898c5060 (diff)
downloadtranslated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip
initial commit
Diffstat (limited to 'files/ar/web/javascript/reference/errors')
-rw-r--r--files/ar/web/javascript/reference/errors/index.html31
-rw-r--r--files/ar/web/javascript/reference/errors/unexpected_type/index.html68
2 files changed, 99 insertions, 0 deletions
diff --git a/files/ar/web/javascript/reference/errors/index.html b/files/ar/web/javascript/reference/errors/index.html
new file mode 100644
index 0000000000..c295fccea6
--- /dev/null
+++ b/files/ar/web/javascript/reference/errors/index.html
@@ -0,0 +1,31 @@
+---
+title: JavaScript error reference
+slug: Web/JavaScript/Reference/Errors
+tags:
+ - Debugging
+ - Error
+ - Errors
+ - Exception
+ - JavaScript
+ - NeedsTranslation
+ - TopicStub
+ - exceptions
+translation_of: Web/JavaScript/Reference/Errors
+---
+<p>{{jsSidebar("Errors")}}</p>
+
+<p>Below, you'll find a list of errors which are thrown by JavaScript. These errors can be a helpful debugging aid, but the reported problem isn't always immediately clear. The pages below will provide additional details about these errors. Each error is an object based upon the {{jsxref("Error")}} object, and has a <code>name</code> and a <code>message</code>.</p>
+
+<p>Errors displayed in the Web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code.</p>
+
+<h2 id="List_of_errors">List of errors</h2>
+
+<p>In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. For more information, follow the links below!</p>
+
+<p>{{ListSubPages("/en-US/docs/Web/JavaScript/Reference/Errors")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Learn/JavaScript/First_steps/What_went_wrong">What went wrong? Troubleshooting JavaScript</a>: Beginner's introductory tutorial on fixing JavaScript errors.</li>
+</ul>
diff --git a/files/ar/web/javascript/reference/errors/unexpected_type/index.html b/files/ar/web/javascript/reference/errors/unexpected_type/index.html
new file mode 100644
index 0000000000..085dc8a167
--- /dev/null
+++ b/files/ar/web/javascript/reference/errors/unexpected_type/index.html
@@ -0,0 +1,68 @@
+---
+title: 'TypeError: "x" is (not) "y"'
+slug: Web/JavaScript/Reference/Errors/Unexpected_type
+tags:
+ - الأخطاء
+ - جافاسكربت
+ - نوع الخطأ
+translation_of: Web/JavaScript/Reference/Errors/Unexpected_type
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="الرسالة">الرسالة</h2>
+
+<pre class="syntaxbox">TypeError: Unable to get property {x} of undefined or null reference (Edge)
+TypeError: "x" is (not) "y" (Firefox)
+
+Examples:
+TypeError: "x" is undefined
+TypeError: "x" is null
+TypeError: "undefined" is not an object
+TypeError: "x" is not an object or null
+TypeError: "x" is not a symbol
+</pre>
+
+<h2 id="نوع_الخطأ">نوع الخطأ</h2>
+
+<p>{{jsxref("TypeError")}}.</p>
+
+<h2 id="ماذا_حصل؟"> ماذا حصل؟</h2>
+
+<p>خطأ غير متوقع، يحدث كثيرا مع {{jsxref("undefined")}} أو قيم {{jsxref("null")}} .</p>
+
+<p>أيضا في بعض الوضائف مثل {{jsxref("Object.create()")}} أو {{jsxref("Symbol.keyFor()")}}, تحتاج تقديد أنواع محددة.</p>
+
+<h2 id="أمثلة">أمثلة</h2>
+
+<h3 id="حالات_غير_صحيحة">حالات غير صحيحة</h3>
+
+<pre class="brush: js example-bad">// undefined and null cases on which the substring method won't work
+var foo = undefined;
+foo.substring(1); // TypeError: foo is undefined
+
+var foo = null;
+foo.substring(1); // TypeError: foo is null
+
+
+// Certain methods might require a specific type
+var foo = {}
+Symbol.keyFor(foo); // TypeError: foo is not a symbol
+
+var foo = 'bar'
+Object.create(foo); // TypeError: "foo" is not an object or null
+</pre>
+
+<h3 class="highlight-spanned" id="حل_المشكلة"><span class="highlight-span"><span class="notranslate">حل المشكلة</span> </span></h3>
+
+<p><span class="notranslate">لإصلاح مؤشر null إلى قيم <code>undefined</code> أو <code>null</code> ، يمكنك استخدام عامل التشغيل <a href="https://translate.googleusercontent.com/translate_c?act=url&amp;depth=1&amp;hl=ar&amp;ie=UTF8&amp;prev=_t&amp;rurl=translate.google.com&amp;sl=auto&amp;sp=nmt4&amp;tl=ar&amp;u=https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof&amp;xid=17259,1500002,15700002,15700021,15700124,15700149,15700186,15700190,15700201,15700214&amp;usg=ALkJrhh23enjQBtOCeYxpsucdSXvqqK0dg">typeof</a> ، على سبيل المثال.</span></p>
+
+<pre class="brush: js">if (typeof foo !== 'undefined') {
+ // الآن نعلم أن القيمة المدخلة غير محددة، نستطيع القيام بأي إجراء بدون خطأ.
+}</pre>
+
+<h2 id="شاهد_أيضاً">شاهد أيضاً</h2>
+
+<ul>
+ <li>{{jsxref("undefined")}}</li>
+ <li>{{jsxref("null")}}</li>
+</ul>