Self-propelled shooter functions



  • Tell me what the difference is and why doesn't it work?

    var obj = {
      a: 10,
      b: (function() {
        return this.a
      })()
    }
    console.log(obj);
    

    var obj = {
    a: 10,
    b: (() => {
    this.a
    })()
    }
    console.log(obj);



  • var obj = { a: 10, b: (function () { return 20; }() }

    Is such a code available to shooters? Principal condition becomes that the function must be self-induced

    //var obj = { a: 10, b: (function () { return 20; }()) } 
    var obj = { a: 10, b: (() => 20)() };
    console.log(obj);


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2