自测this是否掌握

var number = 5;
    var obj = {
      number: 3,
      fn: (function() {
        var number;
        this.number *= 2;
        number = number * 2;
        number = 3;
        return function() {
          var num = this.number;
          this.number *= 2;
          console.log('num',num);
          number *= 3;
          console.log('number',number,this.number)
        }
      })()
    }

    var fn1 = obj.fn;
    fn1.call(null);
    obj.fn();
    console.log(window.number)
看来我还是木有get到this知识点,做对的点赞,我猫下都是哪些大神

你可能感兴趣的:(自测this是否掌握)