Skip to content

Instantly share code, notes, and snippets.

@yuya-takeyama
Forked from KOBA789/this.js
Created July 20, 2012 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuya-takeyama/3149128 to your computer and use it in GitHub Desktop.
Save yuya-takeyama/3149128 to your computer and use it in GitHub Desktop.
あなたがJavaScriptを嫌いになるのに十分なコード
function Class (bar) {
this.foo = bar;
}
Class.prototype.method = function () {
return this.foo;
};
var instance = new Class('baz'),
func = (function () {
return function () {
return instance.method();
}
})();
console.log(instance.method());
console.log(func());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment