Differences between Scope Chain and Closure

53 views Asked by At

According to scope chain inner functions can access to outer functions, but at the same time we are accessing outer function through closure, then what is difference? Can anyone explain differences between scope chain and closure? My version is that scope chain is just a rule and closure is explanation of how this rule works.

Question is about differences between Scoping and Closure

function outer() {
  a = 10;
   function inner() {
    b = 10;
    console.log(a + b);
  };
  return inner()
}

console.log(outer());  //logs: 20
0

There are 0 answers