Skip to content

Instantly share code, notes, and snippets.

@yoko
Created April 24, 2012 04:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoko/2476547 to your computer and use it in GitHub Desktop.
Save yoko/2476547 to your computer and use it in GitHub Desktop.
アイデア思い付いたら書いてくところ
function foo(type) {
return type ?
function() {
return console.log(type);
} :
console.log(this.toString());
}
foo('foo')(); // コールバックで使う
foo.call('foo'); // 単独で使う
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment