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で引数を関数化する方法

Posted at

定義

function functionize(v){
    // 引数vを返す無引数関数を返す
    return (() => v);
}

使用例

// 100を返す関数を作成して変数に格納
const functionizedValue = functionize(100);
// 当該関数を実行した結果を表示
console.log(functionizedValue());

表示結果

100
0
0
2

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?