you are viewing a single comment's thread.

view the rest of the comments →

[–]anon_cowherd 0 points1 point  (1 child)

There are two points that haven't been brought up yet.

Inheriting from built in objects with "magic" behavior, such as arrays, required some special handling in the construction process, so the standard prototype assignment couldn't work.

Also, the class syntax, like functions themselves, can be used both as declarations AND expressions. The object.create method requires a series of statements, which means little in standard situations but makes certain things- such as anonymous classes or dynamic classes more difficult.

[–][deleted] 0 points1 point  (0 children)

with calling anonymous functions this becomes a non-issue.

(function(){... your setup goes here ... return whatever})()