Skip to content

Instantly share code, notes, and snippets.

@kusano
Created March 10, 2014 16:16
Show Gist options
  • Save kusano/9468173 to your computer and use it in GitHub Desktop.
Save kusano/9468173 to your computer and use it in GitHub Desktop.
// 1個目の引数を返す関数 Trueになる
function t(a,b) {return a;}
// 2個目の引数を返す関数 Falseになる
function f(a,b) {return b;}
// aがTrueならbを、aがFalseならcを返す
function test(a,b,c) {return a(b,c);}
test(t,"x","y") // "x"
test(f,"x","y") // "y"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment