Mixins - Basic JavaScript Fast (28) | Object.assign

preview_player
Показать описание
In JavaScript, if we want to add functionality of a class, we can get it from another object without establishing inheritance. This pattern is called a mixin.

Playlist of my JavaScript course

Playlist of my HTML5 and CSS3 tutorials

Playlist of my algorithm walkthrough

Playlist of my Java course

Playlist of my Java examples

Рекомендации по теме
Комментарии
Автор

Thank you! This was great. Straight to the point, good definition and easy to understand.
I was trying to figure out how to use mixins with classes in JS. I tried using other classes as mixins but didn't work the way I wanted to. They either didn't work properly with Object.assign or got overwritten with Object.setPrototypOf. Just making the mixins as objects and using Object.assign works nicely!

Birandoo
Автор

Aren't Mixin objects? Even the assign method takes target and source(s), all as objects. That means Mixin is an object that uses methods from other object(s).

sadiqabdullah
Автор

your english accent is totalement aberrant si je puis me permettre.

happycreeper
visit shbcf.ru