fix: converted single to triple backticks10 (#36237)

This commit is contained in:
Randell Dawson
2019-06-20 14:53:53 -07:00
committed by Tom
parent da6bd27eec
commit 039fea8b6d
75 changed files with 1880 additions and 1655 deletions

View File

@@ -8,26 +8,30 @@ localeTitle: مشغلون شرطيون شرطيون
المشغل الثلاثي هو طريقة مدمجة لكتابة if-else داخل تعبير.
`const thing = (condition) ? <if true> : <if false>;
`
```js
const thing = (condition) ? <if true> : <if false>;
```
على سبيل المثال
`const cappedInput = input > 50 ? 50 : input // this will cap the input at 50
`
```js
const cappedInput = input > 50 ? 50 : input // this will cap the input at 50
```
### آخر إذا
يمكنك أيضًا تشغيل مشغلات ثلاثية ، وبهذه الطريقة سيكون لديك سلوك آخر في حالة ما عدا ذلك
`<first condition> ? <value if first true>
: <second condition> ? <value if second is true>
: <fallback value>
`
```js
<first condition> ? <value if first true>
: <second condition> ? <value if second is true>
: <fallback value>
```
> **نصيحة للمحترفين** : كما ترى ، يمكنك تقسيم المشغل الثلاثي على عدة أسطر على سبيل المثال
`const wealth = housesOwned > 3 ? "rich"
: housesOwned > 1 ? "nothing to complain"
: "poor"
`
```
const wealth = housesOwned > 3 ? "rich"
: housesOwned > 1 ? "nothing to complain"
: "poor"
```