Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
class Person { private name: string; public constructor(name: string) { this.name = name; } public getName(): string { return this.name; } } const person = new Person("Jane"); console.log(person.getName()); // person.name isn't accessible from outside the class since it's private
Jane