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 thoughts on “Higher-order functions – Part 1 of Functional Programming in JavaScript

  • May 7, 2019 at 17:38
    Permalink

    +Andrzej klapek Great point! That is correct, I made a mistake. It's not part of ES6. It's so common that I just assumed that it was. You need to use underscore, lodash or mout.

  • May 7, 2019 at 17:38
    Permalink

    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?

  • May 7, 2019 at 17:38
    Permalink

    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.

  • May 7, 2019 at 17:38
    Permalink

    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.

  • May 7, 2019 at 17:38
    Permalink

    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.

  • May 7, 2019 at 17:38
    Permalink

    Me: "why isn't he writing arrow function? 🤔"
    Me: "ooohhhhhh 😱"

    Me: "but why are you looking like a redneck? 🤔"
    Me: "ohhhhh 😱"

  • May 7, 2019 at 17:38
    Permalink

    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!

  • May 7, 2019 at 17:38
    Permalink

    HEY! I don't know if anyone else said this in your comments but your missing a comma in your array declaration xD @ Harold, The Fish!

Leave a Reply