Use an IIFE to Create a ModulePassed

Why do need to add IIFE if we can do the same without it, that is assign the object consisting of mixings to a variable, and then refer to it? What is the use of adding IIFE?

  **Your code so far**

let funModule = 
(function() {
return {
isCuteMixin: function(obj) {
obj.isCute = function() {
  return true;
};
},
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; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36

Challenge: Use an IIFE to Create a Module

Link to the challenge:

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