Private Methods and Fields in JavaScript Classes

Ever since classes were introduced in ECMAScript 2015 people wanted to use private methods and fields, which are well-known from programming languages like C++, PHP or Java. There is now a Stage 3 ECMAScript Proposal regarding private methods, getter/setters and fields. We’ll look at the proposed syntax – which is how you’ll (propably) write private methods and fields in future JavaScript versions – and how to achieve the same functionality with current language features.

Read more… Read more…

You can support manu.ninja via PayPal and buy me a 🍺 or a cup o’ joe.