📜  Javascript 中的隐私封装 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:38.778000             🧑  作者: Mango

代码示例1
class ClassWithPrivateField {
  #privateField;
}

class ClassWithPrivateMethod {
  #privateMethod() {
    return 'hello world';
  }
}

class ClassWithPrivateStaticField {
  static #PRIVATE_STATIC_FIELD;
}

class ClassWithPrivateStaticMethod {
  static #privateStaticMethod() {
    return 'hello world';
  }
}