- I think I understand the motions of Object.assign/Object.create, but still can’t understand how it solves the problem of deep hierarchies. You can have 6 level hierarchy through extends, you can build exactly the same hierarchy through Object.assign and Object.create, right? Why is it better?
- Animal/mouse example seems to be a too simple example for this discussion. I’ve just done it via classes/extends to compare and the code actually looks cleaner: a. you have just “extends” instead of “return Object.assign(Object.create….”; b. you get less curly-brace nesting; have you came across an example of moderate complexity which demonstrates pros of this approach over classes? I’m specifically asking about moderate complexity example, since frameworks like express which you can surely look into, do not seem to be something you can interrogate pretty quickly.
Thanks for the article, BTW, it explains how to do prototype inheritance very well.