In JavaScript, what is a closure ?

2026

In JavaScript, what is a closure ?

  1. A.

    A function that returns nothing

  2. B.

    A function bundled with its lexical environment

  3. C.

    A loop termination condition

  4. D.

    An error handling mechanism

Attempted by 71 students.

Show answer & explanation

Correct answer: B

A closure is a function bundled with its lexical environment, allowing access to outer variables even after the outer function has returned.

Explore the full course: Tpsc Assistant Technical Officer