0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JavaScriptによる関数の合成

Last updated at Posted at 2025-01-09

関数定義

function compose_funcs(f1, f2){
    return function(v){
        return f2(f1(v));
    };
}

呼び出し

const result = compose_funcs(e => e + 2, e => e + 5)(100);
console.log(result);

表示結果

107
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?