DEV Community

Discussion on: Anonymous Recursion in JavaScript

Collapse
 
yuriss profile image
Yuri Santos • Edited

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.

Collapse
 
bitwiselover profile image
undefined

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.

Collapse
 
simov profile image
simo • Edited

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.