When a function is defined inside another function and has access to the outer function’s variables, the inner function is known as a _________.
- Nested Function
- Inner Function
- Callback Function
- Closure
A closure is a JavaScript feature where a function has access to variables from its containing (enclosing) function's scope even after the outer function has finished executing. It's a powerful concept for maintaining data privacy and creating functions that remember and can access their outer scope.
Loading...
Related Quiz
- How do you declare a two-dimensional array in JavaScript?
- Arrow functions were introduced in ECMAScript _________.
- The method myArray.find(callback) returns _______ if no element passes the test.
- You are working on a web application where you need to fetch data from an API, perform operations on it, and then use it to update the UI. Which JavaScript feature allows you to handle these asynchronous operations more readably and reliably?
- Unlike traditional functions, arrow functions do not have their own __________.