Created
March 11, 2016 09:12
-
-
Save phi16/f504b8e3dd5c13bd3d66 to your computer and use it in GitHub Desktop.
Entangled function
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
var e = (()=>{ | |
var c = 0; | |
return { | |
a : ()=>c, | |
b : (x)=>{c=x;} | |
}; | |
})(); | |
var a = e.a; | |
var b = e.b; | |
console.log(a()); // => 0 | |
b(4); | |
console.log(a()); // => 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment