---
title: "Discussion on \"Higher-Order Functions(HoF) in JavaScript - Explain Like I'm Five\" | Hashnode"
description: "Discussion on \"Higher-Order Functions(HoF) in JavaScript - Explain Like I'm Five\". A Higher-Order function is a widely used functional programming concept in JavaScript. Let's learn what they are and their benefits with examples."
url: "https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Higher-Order Functions(HoF) in JavaScript - Explain Like I'm Five](https://blog.greenroots.info/higher-order-functions-in-javascript?utm_source=hashnode&utm_medium=feed)

A Higher-Order function is a widely used functional programming concept in JavaScript. Let's learn what they are and their benefits with examples.

Dec 28, 2021 · 7 min read · blog.greenroots.info  
Updated Feb 3, 2022  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#functional-programming](https://hashnode.com/tag/functional-programming)
-   [#codenewbies](https://hashnode.com/tag/codenewbies)

## Written by

[Tapas Adhikary](https://hashnode.com/@atapas)

@atapas · Bangalore

  
[View profile](https://hashnode.com/@atapas)

Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source

Co-Founder, @CreoWis | Teacher, @tapaScript | Founder, @ReactPlay | YouTuber | Writer | Human

## Responses 18

Markdown supported · ⌘↵ to post

[Yahaya Oyinkansola](https://hashnode.com/@Kansoldev)

[Mar 25, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/623de469b6813c8a18c2266b)

This is such a well explained article on HoF, thank you for the explanation

[Tapas Adhikary](https://hashnode.com/@atapas)

[Mar 26, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/623de469b6813c8a18c2266b#reply-623f14ca2209c88a3de91ae6)

Thank you very much ✨

[Spencer Cooper](https://hashnode.com/@Sjc01234)

[Mar 4, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/6222035c5998063ea60d7fdb)

I'm still not seeing the difference between the first example and last example. The last being a callback with explanation saying it's not the same thing....but the very first example of a HoF is literally the same thing.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Mar 6, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/6222035c5998063ea60d7fdb#reply-62242ee7e814324bc83a9b38)

Hey [Spencer Cooper](https://hashnode.com/@Sjc01234), could you please be a little more precise with what you meant by the first and last examples. Indeed, I'll try my best to clarify your doubts with answers. Cheers.

[crane168](https://hashnode.com/@crane68)

[Feb 28, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/621c7563085330c3f79c4d87)

yeah，this article help me lots.I like these methods!pure function

[Tapas Adhikary](https://hashnode.com/@atapas)

[Mar 6, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/621c7563085330c3f79c4d87#reply-62242ea7e814324bc83a9b30)

Thanks a lot [crane168](https://hashnode.com/@crane68)

[Hrithwik Bharadwaj](https://hashnode.com/@hrithwik)

[Jan 4, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61d4316946e56e75ab373a81)

Super Neat Explanation

[Tapas Adhikary](https://hashnode.com/@atapas)

[Jan 4, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61d4316946e56e75ab373a81#reply-61d44923220e987977668e40)

Thanks a lot, [Hrithwik](https://hashnode.com/@hrithwik). It's motivating coming from you!

[Ankur Tyagi](https://hashnode.com/@TheAnkurTyagi)

[Jan 3, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61d304152850417068a1a5d9)

Such a great blog [Tapas Adhikary](https://hashnode.com/@atapas) Thanks for sharing.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Jan 3, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61d304152850417068a1a5d9#reply-61d304f5d335286be6cde4f2)

Thank you [Ankur](https://hashnode.com/@TheAnkurTyagi) sir. It means a lot.

[Raghav Thind](https://hashnode.com/@RaghavThind)

[Jan 1, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61d015840cfc5655c184464c)

Brilliant article, I also loved the way you explain concepts

[Tapas Adhikary](https://hashnode.com/@atapas)

[Jan 1, 2022](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61d015840cfc5655c184464c#reply-61d0871d7cb96c3f92261509)

Thanks a lot, Raghav 😀

[Shashi Jakka](https://hashnode.com/@ssJvirtually)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cde7747cb96c3f9225e3a2)

Clean examples and Clear explanation

Keep up the good work!!

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cde7747cb96c3f9225e3a2#reply-61ce074f7cb96c3f9225e6dd)

Thank you very much, Shashi.

[Favourite Jome](https://hashnode.com/@Favourite)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61ccfa87bf6808370221254d)

Wonderfully explained [Tapas Adhikary](https://hashnode.com/@atapas) 🚀

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61ccfa87bf6808370221254d#reply-61cd3f7a351cb236ddfb779b)

Thank you, [Favourite Jome](https://hashnode.com/@Favourite). Glad you enjoyed reading it.

[Kritika Pattalam Bharathkumar](https://hashnode.com/@kritika-pattalam)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61ccf93a351cb236ddfb73b5)

Great article. Thanks for sharing.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61ccf93a351cb236ddfb73b5#reply-61cd3f90bf680837022128e1)

Thanks [Kritika Pattalam Bharathkumar](https://hashnode.com/@kritika). Much appreciate it.

[Victoria Lo](https://hashnode.com/@victoria)

[Dec 29, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cc4f7a613e3232dc64520b)

Another amazing and brilliant article! Good job on this one Tapas!

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cc4f7a613e3232dc64520b#reply-61cd3fae351cb236ddfb77a4)

Woohoo... Thanks a lot, [Victoria](https://hashnode.com/@victoria)

[Suhail Kakar](https://hashnode.com/@suhailkakar)

[Dec 29, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cc18cd5e8b9423aa06a5e5)

Such a great article, Tapas! Thanks for sharing :)

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 30, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cc18cd5e8b9423aa06a5e5#reply-61cd3fc6bf680837022128f2)

Thanks [Suhail](https://hashnode.com/@suhailkakar) brother. Much appreciate.

[Idris Olubisi](https://hashnode.com/@olanetsoft)

[Dec 29, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cba8599d3f4828b7ba4d84)

Great article as usual. [Tapas Adhikary](https://hashnode.com/@atapas) Thanks for sharing

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 29, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cba8599d3f4828b7ba4d84#reply-61cbce3e5e8b9423aa069ee2)

Thanks, man, I appreciate it.

[Sumudu Siriwardana](https://hashnode.com/@sumudusiriwardana)

[Dec 29, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cba6db5e8b9423aa069d34)

Great article, Tapas. I really like the way you have explained things simply with examples. Thank you for this article!

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 29, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cba6db5e8b9423aa069d34#reply-61cbce205e8b9423aa069edb)

Thanks a lot, Sumudu 😀

[Zahab kakar](https://hashnode.com/@zahabkakar)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb62185e8b9423aa0699c0)

This was one of the great articles I read today, Thanks for the explanation.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb62185e8b9423aa0699c0#reply-61cb95eb9d3f4828b7ba4cda)

Thank you, Zahab. Glad you enjoyed it.

[Annie 🦄⚡](https://hashnode.com/@anniebombanie)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb593c9d3f4828b7ba491d)

This was an incredible article on HoFs, Tapas! I appreciated how you broke it down sequentially and all the examples you used. I have one question, what is 'pad' short for? (This was the parameter for number that you want to increament or decerement)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb593c9d3f4828b7ba491d#reply-61cb96769d3f4828b7ba4ce7)

Thanks, Annie! Glad you liked it.

Ah, `pad` is probably not that intuitive 😀. I meant it for padding. Kind of offset by which we want to increment and decrement. It surely deserves a better name...hehe 😀.

[Sai Teja](https://hashnode.com/@saaitejaa)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb50f49d3f4828b7ba4897)

Pretty good explanation!

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb50f49d3f4828b7ba4897#reply-61cb968c9d3f4828b7ba4cf4)

Thanks a lot, Sai.

[Kaushal Joshi](https://hashnode.com/@kaushal-joshi)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb0e4d5e8b9423aa0692de)

Thanks for the explanation, [Tapas](https://hashnode.com/@atapas).

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61cb0e4d5e8b9423aa0692de#reply-61cb21ff9d3f4828b7ba4488)

My pleasure, [Kaushal](https://hashnode.com/@clumsycoder)

[Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61caea4633e7cd256b0fd0ef)

Great article [Tapas Adhikary](https://hashnode.com/@atapas).

I enjoyed how you explained everything and examine the HoF from all perspectives.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 28, 2021](https://hashnode.com/posts/higher-order-functions-in-javascript/61ca948a33e7cd256b0fc797/comment/61caea4633e7cd256b0fd0ef#reply-61caebeb33e7cd256b0fd123)

Great, thanks a lot, [Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou).
