在Class中方法写在constructor里面与外面的区别

class A { constructor() { this.inside = function () {}; } outside() {} } const a1 = new A(); const a2 = new A(); console.log(a1.outside a2.outside); /
posted @ 2022-05-11 14:24  Yune_Neko  阅读(277)  评论(1编辑  收藏  举报