LoginSignup
1
0

More than 5 years have passed since last update.

アロー関数式のひとつのノート

Posted at
function Yige(x){
    this.instance={
        init:function(x){
            this.x=x;
        }
    };
    this.instance.init(x);
    return this;
}

console.log(new Yige(2).instance.x);

そのinit関数はアロー関数式になると、コンソールにはundefinedが出る。一応ノートを作っておこう。

アロー関数式 は、function 式より短い構文で、this, arguments, super, new.target を束縛しません。アロー関数式は、メソッドでない関数に最適で、コンストラクタとして使うことはできません。

1
0
4

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
0