运行 ❯
获取您
自己的 Node
服务器
×
更改方向
更改主题,深色/浅色
转到 Spaces
class Person { private readonly name: string; public constructor(name: string) { // name cannot be changed after this initial definition, which has to be either at it's declaration or in the constructor. this.name = name; } public getName(): string { return this.name; } } const person = new Person("Jane"); console.log(person.getName());
Jane