freeCodeCamp Challenge Guide: Understand the Immediately Invoked Function Expression (IIFE)

Understand the Immediately Invoked Function Expression (IIFE)


Problem Explanation

The first test case asks you to make the function anonymous. To do this simply remove the name of the function as seen in the example. The function must then be wrapped in parentheses with another set of parentheses at the end to immediately call the function.


Solutions

Solution 1 (Click to Show/Hide)
(function() {
  console.log("A cozy nest is ready");
})();
9 Likes