ć«ćŖć¼å
å¤å¼ę°é¢ę°ććé¢ę°ćčæćé¢ę°ććä½æć£ć¦å®ē¾ććććØ code:ts
const add = ( x , y ) => x + y
āć«ćŖć¼åćć
code:ts
const add = x => y => x + y
å³č¾ŗć x => ( y => x + y ) ćØćæććØććå¼ę°xćåćåć£ć¦é¢ę° y => x + yćčæćé¢ę°ćć§ććććØćććć
é¢ę°ć®ä½æćę¹
ć«ćŖć¼åćć¦ććŖć -> add(2,3)
ć«ćŖć¼åćć¦ćć -> add(2)(3)
ć«ćŖć¼åćć¦ććé¢ę°ć ćØ仄äøć®ććć«ļ¼éØåé©ēØļ¼é¢ę°ćęø”ćććØćć§ćć ććØććØ2å¼ę°ć ć£ćé¢ę°ć«1ć¤ć ćé¢ę°ćäøćććØććć®å¼ę°ćåŗå®ćććććŖé¢ę°ćå¾ćććØćć§ćć
xćØyć®ćć”xć2ć«åŗå®ćććććŖé¢ę°ćå¾ććć
ććē®ēć«ē¹åććé¢ę°ļ¼2ćč¶³ćććØć«ē¹åććé¢ę°ļ¼ćęč»ć«ä½ćććØććććØćØčØćć
code:ts
const add = x => y => x + y
console.log(add(2)) // > y => x + y