4 ms·
To be fair, JavaScript has been a moving target and things like classes are quite new. Then again, it doesn't make sense to avoid features just because they're
by beatgammit 8y ago
To be fair, JavaScript has been a moving target and things like classes are quite new. Then again, it doesn't make sense to avoid features just because they're new.
I think the point is that they want to provide two ways to do simple things: classes and functions. Functions have better performance, classes are more flexible.
- krapp 8y ago>I think the point is that they want to provide two ways to do simple things: classes and functions. At the risk of seeming like an old man complaining about new things, what problem would "classes" solve in javascript that the existing object syntax, which allows for inner functions and variables, doesn't?
- deleted 8y ago[deleted]
- WorldMaker 8y agoPrototypal inheritance, and scope controls more refined/easier to work with than IIFEs. In the end the class notation is "simply" syntax sugar giving the object syntax the benefit of Function.prototype and IIFE closures, without having to resort to layers of either/both.