πŸ“Š JavaScript
Q. Among the given statements, which statement defines closures in JavaScript?
  • (A) JavaScript is a function that is enclosed with references to its inner function scope
  • (B) JavaScript is a function that is enclosed with references to its lexical environment
  • (C) JavaScript is a function that is enclosed with the object to its inner function scope
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) JavaScript is a function that is enclosed with references to its lexical environment

Explanation: A closure is a function that is enclosed with references to its lexical environment. A closure allows an inner function to access the scope of an outside function. Closures are formed every time a function is created in JavaScript, during function creation time.

Explanation by: Chandani
A closure is a function that is enclosed with references to its lexical environment. A closure allows an inner function to access the scope of an outside function. Closures are formed every time a function is created in JavaScript, during function creation time.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
129
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Chandani
Publisher
πŸ“ˆ
90%
Success Rate