Use an IIFE to Create a Module 5

Tell us what’s happening:
Stuck yet again on the final challenge of this lesson. Ugh, why does my learning disability have to kick in? I’ve tried what the hint says to do, but it keeps coming out as incorrect for some reason.

Your code so far


let isCuteMixin = function(obj) {
  obj.isCute = function() {
    return true;
  };
};
let singMixin = function(obj) {
  obj.sing = function() {
    console.log("Singing to an awesome tune");
  };
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 Avast/72.0.1174.122.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module

What have you tried? Can you update your recent code?

What specific questions do you have?

Answer is pretty much given in the instructions. Can you follow this example?

let motionModule = (function () {
  return {
    glideMixin: function (obj) {
      obj.glide = function() {
        console.log("Gliding on the water");
      };
    },
    flyMixin: function(obj) {
      obj.fly = function() {
        console.log("Flying, wooosh!");
      };
    }
  }
}) (); // The two parentheses cause the function to be immediately invoked

I was an airhead this morning and finally figured it out. But thank you anyways, @shimphillip! I’m glad I figured it out when my brain wanted to finally work.