Skip to content

Commit 31da792

Browse files
committed
merging all conflicts
2 parents 45f086b + c3a11c8 commit 31da792

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

1-js/02-first-steps/09-comparison/article.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@
44

55
: وفي لغة الجافسكريبت تكتب كما يلي
66

7+
<<<<<<< HEAD
78
- أكبر/أصغر من: <code>a &gt; b</code>, <code>a &lt; b</code>.
89
- أكبر/أصغر من او يساوي: <code>a &gt;= b</code>, <code>a &lt;= b</code>.
910
- يساوي: `a == b` ، يرجى ملاحظة أن علامة المساواة المزدوجة` = `تعني اختبار المساواة ، في حين أن كلمة واحدة` a = b` تعني تعيين أو مساواة .
1011
- لا تساوي. في الرياضيات يكون الترميز <code>&ne;</code> ،لكن في JavaScript تكتب هكذا <code>a != b</code>.
12+
=======
13+
- Greater/less than: <code>a &gt; b</code>, <code>a &lt; b</code>.
14+
- Greater/less than or equals: <code>a &gt;= b</code>, <code>a &lt;= b</code>.
15+
- Equals: `a == b`, please note the double equality sign `==` means the equality test, while a single one `a = b` means an assignment.
16+
- Not equals. In maths the notation is <code>&ne;</code>, but in JavaScript it's written as <code>a != b</code>.
17+
>>>>>>> c3a11c85e54153ebb137b5541b1d1f751c804439
1118
1219
في هذه المقالة سنتعلم المزيد عن الأنواع المختلفة من المقارنات ، وكيف تجعلها JavaScript، بما في ذلك الخصائص المهمة.
1320

1-js/04-object-basics/07-optional-chaining/article.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ alert( user && user.address && user.address.street ); // يظهر لنا undefin
4040

4141
يؤدي التسلسل الاختياري `.?` إلى إيقاف تقييم الكود البرمجي وإرجاع `undefined` إذا كانت قيمة الجزء الموجود قبل (أيسر) التركيب `.?` هي `null` أو `undfined`.
4242

43+
<<<<<<< HEAD
4344
وللإيجاز، سنقول ضمن هذه المقالة أن شيئاً ما "موجود" إذا لم تكن قيمته `null` ولم تكن `undefined` كذلك.
4445

46+
=======
47+
**Further in this article, for brevity, we'll be saying that something "exists" if it's not `null` and not `undefined`.**
48+
>>>>>>> c3a11c85e54153ebb137b5541b1d1f751c804439
4549
4650
وأما الطريقة الآمنة للوصول لـِ `user.address.street` هي:
4751

@@ -57,14 +61,20 @@ alert( user?.address?.street ); // سيظهر لنا بدون حدوث خطأ un
5761
let user = null;
5862

5963
alert( user?.address ); // undefined
60-
6164
alert( user?.address.street ); // undefined
62-
alert( user?.address.street.anything ); // undefined
6365
```
6466
67+
<<<<<<< HEAD
6568
يرجى ملاحظة أن التركيب أو الشقّ `.?` يعمل بشكل صحيح حيث يتم وضعه بالضبط، وليس بعد ذلك المكان الذي تم وضعه فيه.
6669
6770
في السطرين الأخيرين، سيتوقف تقييم الكود البرمجي بشكل فوري بعد الشقّ `.?user` ولا يستمر أبداً للخصائص التي تليه. ولكن إذا كان الغرض `user` موجوداً بالفعل، فيجب أن تكون الخصائص الوسيطة موجودة ونقصد بالخصائص الوسيطة `user.address` مثلاً.
71+
=======
72+
Please note: the `?.` syntax makes optional the value before it, but not any further.
73+
74+
In the example above, `user?.` allows only `user` to be `null/undefined`.
75+
76+
On the other hand, if `user` does exist, then it must have `user.address` property, otherwise `user?.address.street` gives an error at the second dot.
77+
>>>>>>> c3a11c85e54153ebb137b5541b1d1f751c804439
6878
6979
```warn header="لا تفرط في استخدام تركيب التسلسل الاختياري"
7080
يجب أن نستخدم التركيب `.?` فقط عندما يكون هناك غرض، كائن أو خاصية غير موجودة بالأصل.
@@ -74,14 +84,23 @@ alert( user?.address.street.anything ); // undefined
7484
وبالتالي، إذا كان غرض المستخدم `user` غير معرف بسبب خطأ ما، فسوف نعرف عن هذا الخطأ ونصلحه. وإلا ستتسبب هذه الطريقة بإسكات الأخطاء البرمجية وقد لا يكون ذلك مناسباً، بل سيصبح من الصعب تصحيح هذه الأخطاء وكشفها.
7585
```
7686
87+
<<<<<<< HEAD
7788
````warn header="المتحول الواقع قبل التركيب `.?` يجب أن يكون معرّفاً"
7889
إذا لم يتمّ تعريف المتحول `user`، سيؤدي التعبير `user?.anything` إلى حصول خطأ:
90+
=======
91+
````warn header="The variable before `?.` must be declared"
92+
If there's no variable `user` at all, then `user?.anything` triggers an error:
93+
>>>>>>> c3a11c85e54153ebb137b5541b1d1f751c804439
7994
8095
```js run
8196
// ReferenceError: user is not defined
8297
user?.address;
8398
```
99+
<<<<<<< HEAD
84100
يقوم التسلسل الاختياري فقط باختبار القيم `null/undefined`، ولا يتداخل مع ميكانيكية أي من اللغات الأخرى.
101+
=======
102+
There must be `let/const/var user`. The optional chaining works only for declared variables.
103+
>>>>>>> c3a11c85e54153ebb137b5541b1d1f751c804439
85104
````
86105

87106
## اختصار الطرق (Short-circuiting)

0 commit comments

Comments
 (0)