Ask HN: What's the point of a constructor function anyways?
While trying out a project in Javascript, I decided to finally learn a bit about the "prototype". I'm at the crossroads where I want to decide whether I want to use "pure" prototypal inheritance as with "Object.create" or whether I want to go with "new Class(params...)". As I investigate and weight between my choices, I realize that "When Object.create is used, it is like having only the prototype objects, and empty constructors." So what is the point of constructors anyways? Picking between Object.create and "new" is based on how important are constructors for getting things done. Can you help me brainstorm through this?
5 comments
[ 4.6 ms ] story [ 18.5 ms ] threadHere's the article I was just looking at:
http://onsmalltalk.com/objects-classes-and-constructors-smal...
Choice quotes
http://programmers.stackexchange.com/questions/224033/can-we...
Wish I found this one from the very beginning!
* http://outof.me/javascript-prototypal-inheritance-for-classi...
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Intr...
* http://stackoverflow.com/questions/8453887/why-is-it-necessa...