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.

アロー関数まとめてみた

Posted at

書き方

// 通常の関数
function fn(number) = {
  return number * 2
}

// 無名関数
const fn = function(number) = {
  return number * 2
}

// アロー関数
const fn = (number) => {
  return number * 2
}

// 引数が一つだと()を省略できる
const fn = number => {
  return number * 2
}

// 処理が1行だと{}も省略できる
const fn = number => number * 2

// オブジェクトの返り値の場合
const fnObj = number => (
  {result : number }
)

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?