Cover image by Christiaan Colen on Flickr
As you may noticed, JavaScript got real classes with it's ES2015 update, but many people still want bett...
For further actions, you may consider blocking this person and/or reporting abuse
Some really new stuff I didn't know before! Thanks a heap! ES6 FTW!
Technically not even ES2018, but yes. :)
Dang! It's hard to keep updated with the numbering! :P
yes, every year another JS
I'd really like to have a strict mode for fields as well: only declared fields exist. Right now typos can ruin everything, when you have
this.itemList
in the constructor and assign tothis.itmeList
elsewhere, then spend a half-day scratching you head wondering why some bits of the code don't work!Guess that's what you get with dynamic typing :D
Isn't "use strict" the solution for that kind of situation?
Sadly no.
TypeScript or Flow are the solution.
Thanks for the article ! ,but I have a small remark regarding that javascript has now real classes,it's not true, javascript is always prototype-based, the class keyword is no more than syntactical sugar , because believing the language has real classes can lead to confusion in developement especially when comparing to other class-based languages.
This is true.
The prototype approach of JavaScript is more flexible than the stuff that other languages are doing. In fact, most people did implement their own class system on top of it, the ES2015
class
syntax is just a standardization of these systems.