Private and public ES6 class fields are not yet supported outside of Chrome

Created a web app. Used ES6 classes, including the use of private and public fields. Tested the app — all good.

Started to do multi-browser testing and got errors. FireFox was good enough to explicitly mention that class fields are not supported.

I find that if you declare the fields inside the constructor, IntelliSense will still pick them up. Having up-front field declarations, however, does make a class more readable and similar looking to C++ / Java / C#

Field Declaration info on MDN

Tried with FireFox 67.0.2, Edge 44.17763.1.0, and Chrome 75.0.3770.80

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s