Skip to main content

--description--

A common pattern in JavaScript is to execute a function as soon as it is declared:

(function () {
console.log("Chirp, chirp!");
})();

This is an anonymous function expression that executes right away, and outputs Chirp, chirp! immediately.

Note that the function has no name and is not stored in a variable. The two parentheses () at the end of the function expression cause it to be immediately executed or invoked. This pattern is known as an immediately invoked function expression or IIFE.

--instructions--

Rewrite the function makeNest and remove its call so instead it's an anonymous immediately invoked function expression (IIFE).

--hints--

The function should be anonymous.

assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, '')));

Your function should have parentheses at the end of the expression to call it immediately.

assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, '')));

--seed--

--seed-contents--

function makeNest() {
console.log("A cozy nest is ready");
}

makeNest();

--solutions--

(function () {
console.log("A cozy nest is ready");
})();

(function () {
console.log("A cozy nest is ready");
}());

(() => {
console.log("A cozy nest is ready");
})();

(() =>
console.log("A cozy nest is ready")
)();