In general, one should ignore reading this further as, we are talking about yet another way to make a class field Private in JavaScript! We, the JS Developer community know more than couple of ways to do it already.

Be it,

  • Using Class Constructor
  • Using Closure
  • Keeping private data in WeakMaps
  • Using convention with underscore(_)
  • … and very recently, Using ES6 Symbols

With any of the methods listed above, nothing really comes as a direct offering from JavaScript Language. Some of these methodologies are not making the fields truly private, well, until now.

#javascript #node.js #js #node #programming

Private class fields in JavaScript
1.35 GEEK