You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 函数实现functionprivate(){leta='我是私有变量';this.getName=function(){returna;}}constp=newprivate()console.log(p.a)console.log(p.getName())// class 实现classprivate1{constructor(){leta='我是私有变量';this.getName=function(){returna;};}}constp1=newprivate1()console.log(p1.a)console.log(p1.getName())
Activity
luckept commentedon Jul 7, 2022
闭包版
myltx commentedon Jul 7, 2022