Use a Mixin to Add Common Behavior Between. Unrelated Objects

Use a Mixin to Add Common Behavior Between. Unrelated Objects
0

#1

Tell us what’s happening:

Where is my wroong.I believe is very easy.

Your code so far


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

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

// Add your code below this line

let glideMixin = function(glide) {
  glideMixin.bird = function(glide) {
    console.log("glide");
  }
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects


#2

Just follow the example given,

let flyMixin = function(obj) {
  obj.fly = function() {
    console.log("Flying, wooosh!");
  }
};

flyMixin(bird);
flyMixin(plane);

Now compare your code, you will get it


#3
let glideMixin = function(glide) {
  glideMixin.bird = function(glide) {

In the second line you should access the variable that was passed to the glideMixin function, not the function name