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 mapObject(obj = null, mapper = function(obj){return obj}){
    return mapper(obj)
};

関数呼び出し例

const x = mapObject(100, v => v * v);
console.log(x);

表示結果

10000
0
0
0

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?