1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

JavaScript : 関数型プログラミング

Posted at

関数型プログラミング

・すべての関数は値を返す
・関数には副作用がない(参照透過性)
・関数を値として扱う

Code Sample

// すべての関数は値を返す  
function helloWorld() {
  return "Hello Functional JavaScript !"
}

var xValue = 8
var yValue = 2

function calculation(calc) {
  return calc(xValue, yValue)
}

// 関数には副作用がない
function add(x, y) {
  return x + y
}

// 関数を値として扱う 
console.log(calculation(add)) // 10

GitHub

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?