Function return example update

This commit is contained in:
Marco Dizo 2020-01-16 18:29:21 +08:00
parent a4a84083a7
commit e817e10688

View file

@ -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' );