GitbookIO / javascript

GitBook teaching programming basics with Javascript
https://gitbook.gitbook.io/learn-javascript/
Apache License 2.0
3.53k stars 1.01k forks source link

is 'Higher Order Functions' as the same as 'javascript closure'? #52

Open ldong opened 10 years ago

ldong commented 10 years ago

In 6.2 Higher Order Functions, could you tell the difference compare to javascript closure?

For me this so called 'Higher order functions' is exactly how I understand 'closure'. If I'm right, please add 'this is what other people called closure' at the end of this section. It surely will clarify the misunderstanding.

@SamyPesse @AaronO Thank you

mrsaeeddev commented 7 years ago

In JS, Higher Order Functions are also known as Callbacks. Concept of closures is different.

SivaNagaKalyan commented 2 years ago

Higher Order Functions are functions that either takes function as an argument or returns function and closure is a different concept. so what is closure ? -- closure is a power of inner function where it is able to access variables from outer function even after the outer function is returned.