Web Technology
primer-original-v2mediumJavaScriptClosureScopeFunctionsprimer-original-v2

What is a closure in JavaScript?

Answer options

A
A function that calls itself recursively
B
A function that retains access to variables from its outer (enclosing) scope even after that scope has finished executing
C
A function without a return statement
D
A function defined inside an object literal

Correct answer: A function that retains access to variables from its outer (enclosing) scope even after that scope has finished executing

Explanation

Quick AnswerThe correct answer is A function that retains access to variables from its outer (enclosing) scope even after that scope has finished executing because it directly addresses the core logic of Web Technology.

This question has been retained as-is due to its unique context.

Related Web Technology questions

Practice more Web Technology questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.