ES6 Classes
javascriptjanuary.com
ES6 Classes
1–10 of 51 posts
Re: ES6 Classes
#2Re: ES6 Classes
#3I’m quite unfamiliar with OOP in JavaScript, so I’d appreciate if someone could chime in with how this differs from ES5: is this just syntactic sugar, or is there a semantic change as well?
Re: ES6 Classes
#4I’m quite unfamiliar with OOP in JavaScript, so I’d appreciate if someone could chime in with how this differs from ES5: is this just syntactic sugar, or is there a semantic change as well?
> JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript.
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: ES6 Classes
#5Re: ES6 Classes
#6Re: ES6 Classes
#7I’m quite unfamiliar with OOP in JavaScript, so I’d appreciate if someone could chime in with how this differs from ES5: is this just syntactic sugar, or is there a semantic change as well?
From MDN[1]: > JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript. [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: ES6 Classes
#8 function foo (a, b) {
compared to the more common: function foo(a, b) {Re: ES6 Classes
#9ES6 classes look like kind of sort of like a class but if you poke it at all you see lots of sharp edges and weird behaviours that make no sense unless you know what it's sugar for.
Re: ES6 Classes
#10I really dislike the formatting with a space between function name and arguments function foo (a, b) { compared to the more common: function foo(a, b) {
It always seemed like an odd choice to me that would make people less likely to adopt it.