Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
class NamedValue
{ private _value: T | undefined; constructor(private name: string) {} public setValue(value: T) { this._value = value; } public getValue(): T | undefined { return this._value; } public toString(): string { return `${this.name}: ${this._value}`; } } const value = new NamedValue
('myNumber'); value.setValue(10); console.log(value.toString()); // myNumber: 10
myNumber: 10