Why module cannot be an object instead of IIFE?

Hi All,

Why module cannot be an object containing functions, like in example below?
Why does it need to be an self invoking function returning the object?


  **Your code so far**

funModule = {
  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 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0

Challenge: Use an IIFE to Create a Module

Link to the challenge:

A big thing is for isolating scope. There is a good discussion here.

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