...

/

JavaScript Private Fields and TypeScript

JavaScript Private Fields and TypeScript

Learn about the private fields in ECMAScript and its comparison with TypeScript access modifiers.

Introduction to ES6 private fields

An experimental proposal to the ECMAScript standard introduces the concept of a private field by using the hash (#) symbol before a property name.

This means that if we are targeting a runtime that supports it, such as Node version 12, we can write a JavaScript class as follows:

Access this course and 1400+ top-rated courses and projects.