记录类上面的一些东西

66 阅读1分钟

记录类上面的一些东西,之前没有注意到

      static add(){
        this.hhh='hhh'//添加到了A上 也是静态方法或者属性
        console.dir(this===A)//true 这里的this是A
      }
      log() {//在this的原型上
        console.log(222)
      }
      bb = () => {//在this上
        console.log('bb')
      }
    }
    let a=new A;
    console.log(a)
    console.dir(A)
    A.add()

运行结果

CC.jpg