2
2

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 5 years have passed since last update.

CoffeeScriptとES6のアローの違い

Posted at
x => {}

と書いたとき、当たり前だけどCoffeeScriptとES6とで挙動は違う。

CoffeeScriptではxという関数の実行になる。

x((function(_this) {
  return function() {
    return {};
  };
})(this));

ES6ならxを引数に持つ無名関数の作成。

(function (x) {});

Rubyでもそうだけど、引数(が存在するとき)のかっこを省略しても可読性が下がるだけで、あまりいいことがない。

x(() => {})
(x) => {}

これならどちらの言語でも(ほとんど)同じ意味。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?