LoginSignup
13
13

More than 5 years have passed since last update.

アロー関数で自己再帰@ES6

Last updated at Posted at 2014-07-24

ECMAScirpt6で導入予定のアロー関数とデフォルト引数を組合せた自己再帰関数。

var fact = ((f=n=>n>1?n*f(n-1):1)=>f)();
fact(5); //== 120

引用元
http://d.hatena.ne.jp/teramako/20130321/p1
http://www.mail-archive.com/es-discuss@mozilla.org/msg22135.html

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