Any difference between First Class Function and High Order Function

前端 未结 6 1572
小鲜肉
小鲜肉 2021-01-29 17:23

I\'m wondering whether/what difference between First Class Function and High Order Function.

I read through those two wiki pages and they looks rather similar. If they

6条回答
  •  独厮守ぢ
    2021-01-29 18:08

    First Class functions can:

    • Be stored in variables
    • Be returned from a function.
    • Be passed as arguments into another function.

    High Order Function is a function that returns another function.

    For example:

    function highOrderFunc() {
      return function () {
        alert('hello');
      };
    }
    

提交回复
热议问题