Created
August 12, 2020 08:49
-
-
Save amorkovin/5ea0d6eb379473073daf36ae49d00b39 to your computer and use it in GitHub Desktop.
Замыкание JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeCounter() { | |
let count = 0; | |
return function () { | |
return count++; | |
}; | |
} | |
let counter = makeCounter() | |
console.log(counter()); | |
console.log(counter()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment