Skip to content

Instantly share code, notes, and snippets.

@pr00thmatic
Last active August 29, 2015 14:15
Show Gist options
  • Save pr00thmatic/285190f07ac5e83285b2 to your computer and use it in GitHub Desktop.
Save pr00thmatic/285190f07ac5e83285b2 to your computer and use it in GitHub Desktop.
js test
var a = (function () {
this.x = 100;
var a = 1;
var showX = function () {
console.log(this.x);
};
var setX = function () {
this.x = -100;
};
showX(); // 100
return {
a : a,
setX : setX,
showX : showX
};
})();
console.log(a.x); // undefined
a.setX();
console.log(a.x); // -100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment