Skip to content

satyajittalukder/js-interview-question

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

JS Interview Questions


Question Answer
What is closure in JavaScript? Answer
Explain event delegation in JavaScript. Answer
What are the differences between let, var, and const? Answer

Closure in JavaScript

Closure is a fundamental concept in JavaScript where a function retains access to its lexical scope, even after the function has finished executing. It means the function 'remembers' its surrounding scope's variables and parameters, even if it's called outside of that scope.

Example:

function outerFunction() {
  let outerVariable = 'I am from the outer function';
  
  return function innerFunction() {
    console.log(outerVariable);
  }
}

let newFunction = outerFunction();
newFunction(); // Output: I am from the outer function

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published