Object Oriented Programming - Use a Mixin to Add Common Behavior Between Unrelated Objects

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

let bird = {
  name: "Donald",
  numLegs: 2
};

let boat = {
  name: "Warrior",
  type: "race-boat"
};

// Only change code below this line

quick question about mixins

let bird = {
  name: "Donald",
  numLegs: 2
};

let boat = {
  name: "Warrior",
  type: "race-boat"
};

// Only change code below this line
let glideMixin= function(obj){
  obj.glide=function(){
    console.log('glidin');
  }
}
glideMixin(bird);
glideMixin(boat);

Does this give the property to the prototype or just lists it as a property ?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.