Confused about javascript function returning multiple functions with many fat arrow

前端 未结 3 1916
攒了一身酷
攒了一身酷 2021-01-16 14:57

I have problem with my cs homework. I need to access the x value of the function, but my codes is returning me an empty function instead of with the values

3条回答
  •  Happy的楠姐
    2021-01-16 15:25

    You could change head function like this:

    const pair = (x, y) => f => f(x, y); 
    const head = f => f(a => a)
    
    console.log(head(pair(1,2)))

提交回复
热议问题