DEV Community

Discussion on: Higher-Order Functions(HoF) in JavaScript - Explain Like I'm Five

Collapse
 
ijash profile image
Jastria Rahmat

So, is HOF is the same concept as Decorator as in python?

And if it's OOP, can this be called some kind of inheritance?

Collapse
 
atapas profile image
Tapas Adhikary

I'm not aware much on Python so can not confirm about it but coming to the OOPs part, it is not exactly inheritance. Inheritance is where we get pass the parent traits to child and also enhance them.

HoF is more to do with function compositions. You create function compose to another, the the output can be composed to another one, and so on.

Collapse
 
tleperou profile image
Thomas Lepérou

JS has landed not that long ago decorators for OOP (mostly) like Python does.