Hacker News new | past | comments | ask | show | jobs | submit login

I think the author mis-understands memory management. The following line argues that, without a reference to the prototype, the object is smaller:

"The other way it differs from the constructor pattern is that the prototype class is not instantiated. Which reduces the memory consumption of the object (among other things)."

Admittedly, there is some ambiguity because the second statement is a fragment. The way Crockford is quoted seems to support this fallacy, though.

Echoing what jashkenas said: anything you may save on a reference to the function's prototype (minimal), you lose when creating copies of each member function.

What Crockford was speaking about in his post was using "new" directly on a function definition. In that specific case, the reference to the prototype is useless, since it is blank. In the OP's "Mammal" example, the prototype reference provides key functionality that is well worth the cost.

I believe you are correct upon re-reading. I'll re-word this statement as soon as I have time. Thank you for bringing this up.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact