IIFE and Higher Order Functions
An IIFE runs immediately and keeps variables private. Higher order functions take or return functions, such as map, filter and your own helpers.
Example
(function () {
const secret = 42;
console.log("IIFE", secret);
})();
const twice = (f) => (x) => f(f(x));
console.log(twice((n) => n + 3)(1));Exercise
Run immediately.
(function () {})Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.