File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
1-js/02-first-steps/14-function-basics/2-rewrite-function-question-or Expand file tree Collapse file tree 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ų ` ? ` :
22
33``` js
44function 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
1212function 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 .
You can’t perform that action at this time.
0 commit comments