Skip to content

Instantly share code, notes, and snippets.

@rndme
Created February 24, 2016 01:18
Show Gist options
  • Save rndme/a83c70e4e7d248d50ac4 to your computer and use it in GitHub Desktop.
Save rndme/a83c70e4e7d248d50ac4 to your computer and use it in GitHub Desktop.
function cls(fn, state){
return Object.freeze(fn.call(state));
}
var x= cls(function(){return{
get: ( )=> this.val,
set: (v)=> this.val=v,
}}, {
val: 654
});
x.get(); // 654
x.val; // undefined !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment