What exactly does the anonymous JavaScript function f => f do?

后端 未结 5 589
庸人自扰
庸人自扰 2020-12-12 16:17

I\'m using a third-party library that has a function that takes functions as arguments. I\'m doing some conditional checks to decide whether or not to add a particular funct

5条回答
  •  一生所求
    2020-12-12 16:38

    f => f is similar* to function(f){ return f; }

    So close, but not quite what you expected.

    * - as has been pointed out in comments, there are subtle differences, but for the sake of your question, I don't think they are particularly relevant. They are very relevant in other situations.

提交回复
热议问题