Higher-order functions – Part 1 of Functional Programming in JavaScript




💖 Support the show by becoming a Patreon
https://www.patreon.com/funfunfunction

In this video series, I will teach you how to do functional programming in JavaScript. In this first one, I will tell you about one of the most important concepts in functional programming: Higher-order functions. I will talk about what higher order-functions are, and then move on to code, and show you how to use them. I will also tell you why you should learn functional programming in the first place.

Original source


21 responses to “Higher-order functions – Part 1 of Functional Programming in JavaScript”

  1. Map, reduce, and filter are obvious winners, so much so, that they have been quickly adopted in imperative languages like java. The harder questions to answer are, … How can FP promote SOLID principles, and "cohesion over coupling", and encapsulation? How do we use FP to make code more readable and lower long term maintenance costs, when working in medium to large teams?

  2. Please please please make a video series on react hooks. I came back to this video series to leave that comment, because it's what set me down my journey of functional programming.

  3. var isDog = function(animal) {
    return animal.species === 'dogs'
    }

    Why isn't it animals.species ? How does the program know to pull from the animals array? I guess I don't understand how animal.species works. Thanks for anyone's help.

  4. Hi, MPJ,
    Sorry I've been out of touch. For months, I was focused on classes, and trying to rebuild my web comic site. And I got pretty discouraged, So I came back to the beginning, as I know I'll need a lot of review.

    And I'm wondering how you get that example code to work. The animals array has elements with species === "dog", not "dogs". And I know computers don't really understand words, so how does a computer know that the animals array of more than one animal. How does the computer recognize what you're asking it to do, when you use a function that uses the argument "animal"? I really wish coding worked so easily, but there might be random chaos, down that path.

    Are we really able to instantiate new variables on the fly, that way, such as "animals", and new values, such as "dogs"?

    Oh, why am I asking here? You're too busy. And if I could even find the forum, how do I bring this up for discussion? … No, wait, I found the forum, and you've made it easy enough for patrons to get back in, even when they're 60, and didn't grow up with computers. Thanks. Posted in forum, under Programming.

  5. I agree that functional design definitely helps you write fewer bugs! This is exactly why I promote a functional design for business logic! Business logic should not rely on state! You should be able to pass in certain arguments and it will behave the same every time! Thanks for the video! This was a great primer for javascript HOFs!

Leave a Reply