Merge pull request #1710 from mdizo/master
Function return example update
This commit is contained in:
commit
00d10515e5
1 changed files with 2 additions and 2 deletions
|
@ -266,7 +266,7 @@ There may be many occurrences of `return` in a single function. For instance:
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
function checkAge(age) {
|
function checkAge(age) {
|
||||||
if (age > 18) {
|
if (age >= 18) {
|
||||||
*!*
|
*!*
|
||||||
return true;
|
return true;
|
||||||
*/!*
|
*/!*
|
||||||
|
@ -277,7 +277,7 @@ function checkAge(age) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let age = prompt('How old are you?', 18);
|
let ageCheck = prompt('How old are you?', 18);
|
||||||
|
|
||||||
if ( checkAge(age) ) {
|
if ( checkAge(age) ) {
|
||||||
alert( 'Access granted' );
|
alert( 'Access granted' );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue