File tree 1 file changed +5
-5
lines changed
1-js/02-first-steps/14-function-basics/2-rewrite-function-question-or
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
- Using a question mark operator ` '?' ` :
1
+ Naudojant operatorių ` ? ` :
2
2
3
3
``` js
4
4
function checkAge (age ) {
5
- return (age > 18 ) ? true : confirm (' Did parents allow you ?' );
5
+ return (age > 18 ) ? true : confirm (' Ar tėvai leido ?' );
6
6
}
7
7
```
8
8
9
- Using OR ` || ` (the shortest variant ):
9
+ Naudojant operatorių ` || ` (trumpiausias variantas ):
10
10
11
11
``` js
12
12
function checkAge (age ) {
13
- return (age > 18 ) || confirm (' Did parents allow you ?' );
13
+ return (age > 18 ) || confirm (' Ar tėvai leido ?' );
14
14
}
15
15
```
16
16
17
- Note that the parentheses around ` age > 18 ` are not required here. They exist for better readabilty .
17
+ Atkreipkite dėmesį, kad skliaustai aplink ` age > 18 ` yra neprivalomi. Jie skirti geresniam kodo skaitomumui užtikrinti .
You can’t perform that action at this time.
0 commit comments