3 ms·
It's been a while since I used it, and I can't remember what the problems were off the top of my head but they were face palm level. Here's a discussion on sta
by Tloewald 13y ago
It's been a while since I used it, and I can't remember what the problems were off the top of my head but they were face palm level.
Here's a discussion on stack exchange:
http://programmers.stackexchange.com/questions/173176/javascript-objects-and-crockfords-the-good-parts http://programmers.stackexchange.com/questions/173176/javasc...
The general problem with all classical inheritance patterns in Javascript is that they don't really work (they treat Javascript as a static language so you get all kinds of nasty surprises because it isn't). This is particularly sad in comparison with older, conceptually simple languages like Objective-C that do this stuff properly.
Crockford himself says it was a mistake to even include the section in the book (in 8 years he's never used it)
http://www.crockford.com/javascript/inheritance.html http://www.crockford.com/javascript/inheritance.html
The takeaway point is that doing classical inheritance in Javascript is a Bad Idea. If you think you've done it, you probably haven't. And no-one will use it.