Quote:
|
Without quibibling over keywords, is there something else that "classes" do that javascript's constructors cannot?
|
First of all, don't believe everything you read on Wikipedia. Remember, it's all written by people who have their own axes to grind.
But are there things that classes
in the most popular class-based languages (C++, Java, C#) do that a JavaScript constructor doesn't? Yes. Many things, Inheritance, polymorphism, static members, templates, and more. Can most of those things be simulated in JavaScript? Yes. But they aren't natural and native to JavaScript. There are some very very powerful constructs that are native to those three (and some other) languages that are difficult (if not well nigh impossible, c.f. templates, a.k.a. "generics") to do in JavaScript.
Please don't get me wrong. I'm not attacking JavaScript; I'm defending it. But I do recognize the very fundamental differences in a class-based language from the principles of prototypes, et al., that JavaScript is built on.
Use each language for its strengths. Don't try or expect any one language to be all things to all people for all uses.