Last active
June 8, 2017 14:29
-
-
Save CubiZm/63d56548271aca52d5e222614efc2584 to your computer and use it in GitHub Desktop.
This file contains 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 numberGenerator() { | |
// Локальная «свободная» переменная, которая доступна только в замыкании | |
var num = 1; | |
function checkNumber() { | |
console.log(num); | |
} | |
num++; | |
return checkNumber; | |
} | |
var number = numberGenerator(); | |
number(); // 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment