File tree Expand file tree Collapse file tree 2 files changed +17
-17
lines changed
1-js/02-first-steps/14-function-basics/1-if-else-required Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Original file line number Diff line number Diff line change 1
- No difference .
1
+ فرقی ندارد .
Original file line number Diff line number Diff line change @@ -2,37 +2,37 @@ importance: 4
2
2
3
3
---
4
4
5
- # Is "else" required?
5
+ # آیا "else" لازم است؟
6
6
7
- The following function returns ` true ` if the parameter ` age ` is greater than ` 18 ` .
7
+ تابع زیر ` true ` را برمیگرداند اگر پارامتر ` age ` از ` 18 ` بزرگتر باشد .
8
8
9
- Otherwise it asks for a confirmation and returns its result :
9
+ در غیر اینصورت برای تأیید سوال میپرسد و سپس جواب را برمیگرداند :
10
10
11
11
``` js
12
12
function checkAge (age ) {
13
- if (age > 18 ) {
14
- return true ;
13
+ if (age > 18 ) {
14
+ return true ;
15
15
* ! *
16
- } else {
17
- // ...
18
- return confirm (' Did parents allow you?' );
19
- }
16
+ } else {
17
+ // ...
18
+ return confirm (' Did parents allow you?' );
19
+ }
20
20
*/ ! *
21
21
}
22
22
```
23
23
24
- Will the function work differently if ` else ` is removed?
24
+ آیا اگر ` else ` را حذف کنیم تابع جور دیگری کار میکند؟
25
25
26
26
``` js
27
27
function checkAge (age ) {
28
- if (age > 18 ) {
29
- return true ;
30
- }
28
+ if (age > 18 ) {
29
+ return true ;
30
+ }
31
31
* ! *
32
- // ...
33
- return confirm (' Did parents allow you?' );
32
+ // ...
33
+ return confirm (' Did parents allow you?' );
34
34
*/ ! *
35
35
}
36
36
```
37
37
38
- Is there any difference in the behavior of these two variants?
38
+ آیا هیچ تفاوتی در رفتار این دو حالت وجود دارد؟
You can’t perform that action at this time.
0 commit comments