Use a Mixin to Add Common Behavior Between Unrelated Objects - Why?

Tell us what’s happening:
I want to understand more about the definition of Mixin. Why is it necessary to write the obj.fly property as a function instead of just a return or console.log(“Flying, woosh!”)? It basically does the same thing that puts this property into the subtypes. Does it not make the GlideMixin function as a mixin?

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(jj) {
    jj.glide = function() {
        console.log ("im gliding");
    }
}

glideMixin(boat);
glideMixin(bird);

console.log(bird.glide);
console.log(boat.glide);




Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 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