Skip to content

Commit 86b3214

Browse files
authored
Merge pull request #36 from mostafaHegab/master
Functions
2 parents c1dd854 + 3139e78 commit 86b3214

8 files changed

Lines changed: 146 additions & 146 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
No difference.
1+
لا اختلاف.

1-js/02-first-steps/15-function-basics/1-if-else-required/task.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
importance: 4
1+
الأهمية: 4
22

33
---
44

5-
# Is "else" required?
5+
# هل "else" مطلوبة?
66

7-
The following function returns `true` if the parameter `age` is greater than `18`.
7+
الدالة التالية ترجع `true` إذا كانت قيمة `age` أكبر من `18`.
88

9-
Otherwise it asks for a confirmation and returns its result:
9+
وإلا فهي تطلب تأكيد وترجع نتيجته:
1010

1111
```js
1212
function checkAge(age) {
@@ -21,7 +21,7 @@ function checkAge(age) {
2121
}
2222
```
2323

24-
Will the function work differently if `else` is removed?
24+
هل سيحدث اختلاف إذا حذفنا `else` ?
2525

2626
```js
2727
function checkAge(age) {
@@ -35,4 +35,4 @@ function checkAge(age) {
3535
}
3636
```
3737

38-
Is there any difference in the behavior of these two variants?
38+
هل هناك أي اختلاف في سلوك الدالتين ؟

1-js/02-first-steps/15-function-basics/2-rewrite-function-question-or/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Using a question mark operator `'?'`:
1+
استخدام معامل علامة الاستفهام `'?'`:
22

33
```js
44
function checkAge(age) {
@@ -14,4 +14,4 @@ function checkAge(age) {
1414
}
1515
```
1616

17-
Note that the parentheses around `age > 18` are not required here. They exist for better readabilty.
17+
لاحظ أن الأقواس حول `age > 18` غير مطلوبة ولكن تم وضعها لزيادة القدرة على قراءة الكود.
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
importance: 4
1+
الأهمية: 4
22

33
---
44

5-
# Rewrite the function using '?' or '||'
5+
# اعد كتابة الدالة باستخدام '?' أو '||'
66

7-
The following function returns `true` if the parameter `age` is greater than `18`.
7+
الدالة التالية ترجع `true` إذا كانت قيمة `age` أكبر من `18`.
88

9-
Otherwise it asks for a confirmation and returns its result.
9+
وإلا فهي تطلب تأكيد وترجع نتيجته:
1010

1111
```js
1212
function checkAge(age) {
@@ -18,9 +18,9 @@ function checkAge(age) {
1818
}
1919
```
2020

21-
Rewrite it, to perform the same, but without `if`, in a single line.
21+
اعد كتابتها للحصول على نفس النتيجة ولكن بدون `if` وفي سطر واحد.
2222

23-
Make two variants of `checkAge`:
23+
اعد كتابة `checkAge`:
2424

25-
1. Using a question mark operator `?`
26-
2. Using OR `||`
25+
1. باستخدام معامل علامة الاستفهام `?`
26+
2. باستخدام OR `||`

1-js/02-first-steps/15-function-basics/3-min/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A solution using `if`:
1+
الحل باستخدام `if`:
22

33
```js
44
function min(a, b) {
@@ -10,12 +10,12 @@ function min(a, b) {
1010
}
1111
```
1212

13-
A solution with a question mark operator `'?'`:
13+
الحل باستخدام معامل علامة الاستفهام `'?'`:
1414

1515
```js
1616
function min(a, b) {
1717
return a < b ? a : b;
1818
}
1919
```
2020

21-
P.S. In the case of an equality `a == b` it does not matter what to return.
21+
لاحظ أن في حالة إذا كان `a == b` لا يهم أي قيمة نرجع.

1-js/02-first-steps/15-function-basics/3-min/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
importance: 1
1+
الأهمية: 1
22

33
---
44

5-
# Function min(a, b)
5+
# دالة min(a, b)
66

7-
Write a function `min(a,b)` which returns the least of two numbers `a` and `b`.
7+
اكتب دالة `min(a,b)` التي ترجع الرقم الأقل بين رقمين `a` و `b`.
88

9-
For instance:
9+
مثلًا:
1010

1111
```js
1212
min(2, 5) == 2
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
importance: 4
1+
الأهمية: 4
22

33
---
44

5-
# Function pow(x,n)
5+
# دالة pow(x,n)
66

7-
Write a function `pow(x,n)` that returns `x` in power `n`. Or, in other words, multiplies `x` by itself `n` times and returns the result.
7+
اكتب دالة `pow(x,n)` التي ترجع `x` مرفوعة لأس `n`. أو بكلمات أخرى, تضرب `x` في نفسها عدد `n` من المرات وترجع الناتج.
88

99
```js
1010
pow(3, 2) = 3 * 3 = 9
1111
pow(3, 3) = 3 * 3 * 3 = 27
1212
pow(1, 100) = 1 * 1 * ...* 1 = 1
1313
```
1414

15-
Create a web-page that prompts for `x` and `n`, and then shows the result of `pow(x,n)`.
15+
انشئ صفحة ويب تطلب من المستخدم قيم `x` و `n` ثم اعرض نتيجة `pow(x,n)`.
1616

1717
[demo]
1818

19-
P.S. In this task the function should support only natural values of `n`: integers up from `1`.
19+
لاحظ أن في هذا السؤال يجب أن تدعم الدالة الأرقام الطبيعية فقط ل `n`: أرقام موجبة أكبر من `1`.

0 commit comments

Comments
 (0)