JavaScriptQuestion 12 of 36
What do you know about immediately invoked functions?
Answer out loud or in your head first, then compare.
Answer
An Immediately Invoked Function Expression is a function called right after it's created.
JavaScript
(function () {
console.log("Hello");
})();Historically it was often used to create a private scope.
JavaScript
(function () {
const secret = "abc";
})();Today it's less needed thanks to:
let
const
ES modulesHow did it go? Be honest — “Not yet” puts the question on your review list.