class Foo { #y constructor(x) { this.x = x this.#y = x * 2 } } const f = new Foo(10) console.log(f) console.log(f.x) // console.log(f.#y) // syntax error
To embed this program on your website, copy the following code and paste it into your website's HTML: