PostHog is an open-source product analytics suite you can self-host. Heatmaps, Recordings, Funnels and more — all in a platform where you can build your own TypeScript plugins!
class Car { _milesDriven = 0 drive(distance) { this._milesDriven += distance } getMilesDriven() { return this._milesDriven } }
Historically - in JavaScript, because we lacked the ability to have private class fields, we’d mark them with an underscore and hope for the best. Now, thanks to recently added Private Class features, we can now mark class fields as private by using the # prefix.
class Car { #milesDriven = 0 drive(distance) { this.#milesDriven += distance } getMilesDriven() { return this.#milesDriven } } const tesla = new Car() tesla.drive(10) tesla.getMilesDriven() // 10 tesla.milesDriven // undefined