Does JavaScript support partial function application?

后端 未结 4 744
盖世英雄少女心
盖世英雄少女心 2021-01-05 01:18

Reading through the Wikipedia article on First-Class functions, there is a nice table of language support for various aspects of functional programming: http://en.wikipedia.

4条回答
  •  情深已故
    2021-01-05 01:56

    var func1 = function(a, b) {
      return a + b;
    }
    
    var func2 = func1.bind(undefined, 3);
    
    func2(1); // 4
    func2(2); // 5
    func2(3); // 6
    

    check docs at developer.mozilla.org

提交回复
热议问题