Skip to content

Commit 0dd8644

Browse files
authored
200%
1 parent 71736f0 commit 0dd8644

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 numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
Using a question mark operator `'?'`:
1+
Naudojant operatorių `?`:
22

33
```js
44
function checkAge(age) {
5-
return (age > 18) ? true : confirm('Did parents allow you?');
5+
return (age > 18) ? true : confirm('Ar tėvai leido?');
66
}
77
```
88

9-
Using OR `||` (the shortest variant):
9+
Naudojant operatorių `||` (trumpiausias variantas):
1010

1111
```js
1212
function checkAge(age) {
13-
return (age > 18) || confirm('Did parents allow you?');
13+
return (age > 18) || confirm('Ar tėvai leido?');
1414
}
1515
```
1616

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.

0 commit comments

Comments
 (0)