2 ms·
I'm not sure it makes sense to rank these two in terms of popularity as they're generally used for very different things. Delegation is heavily used in combina
by pluma 11y ago
I'm not sure it makes sense to rank these two in terms of popularity as they're generally used for very different things.
Delegation is heavily used in combination with constructors (both ES6 classes and traditional) and factories. Extension is typically used to apply default values, merge data objects or update multiple properties at once.
The use of extension in a way that could reasonably be called a "form of inheritance" is mostly limited to mixins, which I would say aren't more popular than using prototypes (at least not obviously so).