Lesson plan

Immediately invoked function expression

An immediately invoked function expression (or IIFE, pronounced "iffy" ) is a programming language idiom which produces a lexical scope using function scoping. It was popular in JavaScript as a method of supporting modular programming before the introduction of more standardized solutions such as CommonJS and ES modules. Immediately invoked function expressions can be used to avoid variable hoisting from within blocks, protecting against polluting the global environment and simultaneously allowing public access to methods while retaining privacy for variables defined within the function. In other words, it wraps functions and variables, keeping them out of the global scope and giving them a local scope.

Back to article

Article summary

An immediately invoked function expression (or IIFE, pronounced "iffy" ) is a programming language idiom which produces a lexical scope using function scoping. It was popular in JavaScript as a method of supporting modular programming before the introduction of more standardized solutions such as CommonJS and ES modules. Immediately invoked function expressions can be used to avoid variable hoisting from within blocks, protecting against polluting the global environment and simultaneously allowing public access to methods while retaining privacy for variables defined within the function. In other words, it wraps functions and variables, keeping them out of the global scope and giving them a local scope.

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.