by flohofwoe · 3y ago · 0 comments
People wanted a different language, they should have gotten more scripting languages in the browser. Not changing JavaScript so much that it's no longer JavaScript.
(things like the scoping rules for 'var' is just bizarre, same with the concept of 'prototypes')
Looking at typical "old-school" Javascript code gives me the creeps the same way as looking at K&R C code ;)
They aren't syntactic sugar? Pretty sure `class Foo { blah() {} }` is equivalent to `function Foo() {}; Foo.prototype.blah = function() {}`.
These differences let you extend built-in things that simply can't be done with old prototype constructor syntax. [1]
[O] I should probably be using a more recent reference like MDN, but the 2ality series always sticks out in my mind whenever "just syntax sugar" comes up: https://2ality.com/2015/02/es6-classes-final.html#safety-che...
[1] https://2ality.com/2015/02/es6-classes-final.html#subclassin...
Totally different meaning.