Now that you're familiar with classes, we can present a very useful idiom called fluent APIs. Using a fluent API feels natural because it allows you to chain method calls without having to create intermediary variables.
Fluent APIs are often used with the builder design pattern, where you configure an object to create by calling different methods one after another, before triggering the effective construction using a build() method.
Here's an example to make this clear:
class Calculator { constructor(private _currentValue: number = 0) { } add(a: number): this { this._currentValue += a; return this; } substract(a: number): this { this._currentValue -= a; return this; } multiply(a: number): this { this._currentValue *= a; return this; } divide(a: number): this...