Update 19_day_closures.md

make 2nd closure example relevant to the topic
pull/844/head
aecepoglu 1 year ago committed by GitHub
parent 55d8e3dbc0
commit 9995ca0c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,19 +68,27 @@ function outerFunction() {
}
return {
plusOne:plusOne(),
minusOne:minusOne()
plusOne:plusOne,
minusOne:minusOne
}
}
const innerFuncs = outerFunction()
console.log(innerFuncs.plusOne)
console.log(innerFuncs.minusOne)
console.log(innerFuncs.plusOne())
console.log(innerFuncs.plusOne())
console.log(innerFuncs.plusOne())
console.log(innerFuncs.minusOne())
console.log(innerFuncs.minusOne())
console.log(innerFuncs.plusOne())
```
```sh
1
0
2
3
2
1
2
```
🌕 You are making progress. Maintain your momentum, keep the good work. Now do some exercises for your brain and for your muscle.
@ -101,4 +109,4 @@ console.log(innerFuncs.minusOne)
🎉 CONGRATULATIONS ! 🎉
[<< Day 18](../18_Day_Promises/18_day_promises.md) | [Day 20 >>](../20_Day_Writing_clean_codes/20_day_writing_clean_codes.md)
[<< Day 18](../18_Day_Promises/18_day_promises.md) | [Day 20 >>](../20_Day_Writing_clean_codes/20_day_writing_clean_codes.md)

Loading…
Cancel
Save