How to pass two anonymous functions as arguments in CoffeScript?

后端 未结 4 891
误落风尘
误落风尘 2020-11-29 04:06

I want to pass two anonymous functions as arguments for jQuery\'s hover, like so:

$(\'element\').hover(
  function() {
    // do stuff on mouseover
  },
  fu         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 04:21

    Without parenthesis or backslash:

    f ->
      0
    , ->
      1
    

    Output on 1.7.1:

    f(function() {
      return 0;
    }, function() {
      return 1;
    });
    

提交回复
热议问题