A function that can access its parent scope, even after the parent function has closed is called JavaScript closure.

const parentMethod = () => {
  const title = 'Advanced JavaScript Questions';
  const innerMethod = () => {
    console.log(title);
  }
  innerMethod();
}
parentMethod();

In other words, a closure gives you access to an outer function's scope from an inner function.

BY Best Interview Question ON 24 Aug 2022

Suggest An Answer