Skip to content

Instantly share code, notes, and snippets.

@tonkotsuboy
Created July 15, 2020 05:06
Show Gist options
  • Save tonkotsuboy/5f4d9149a225b2ed6e325e320005a1e5 to your computer and use it in GitHub Desktop.
Save tonkotsuboy/5f4d9149a225b2ed6e325e320005a1e5 to your computer and use it in GitHub Desktop.
Chrome 84のプライベートメソッドとアクセサ
class Fukuoka {
get #ramen() {
return "ラーメン";
}
#sayHello() {
console.log(`${this.#ramen}はえらい美味しかばい`);
}
constructor() {
this.#sayHello();
}
}
const fukuoka = new Fukuoka(); // OK
// fukuoka.#sayHello(); // NG!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment