Correct me if I'm wrong. Function that returns another function is high order function not a closure. Closure relates to scope and not to return.
That is absolutely correct, a closure has access to the function environment (scope) of it's parent. A higher-order function can be described as a function that accepts a function as an argument and/or returns a function.
Thank you for your input!
I've fixed the definition, this time I got it straight from MDN just to make sure I'm not mistaken something.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Correct me if I'm wrong.
Function that returns another function is high order function not a closure. Closure relates to scope and not to return.
That is absolutely correct, a closure has access to the function environment (scope) of it's parent. A higher-order function can be described as a function that accepts a function as an argument and/or returns a function.
Thank you for your input!
I've fixed the definition, this time I got it straight from MDN just to make sure I'm not mistaken something.