💖 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”
+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.
Thanks man. Really good videos.
because we're writing enterprise-grade software hahaha
great tutorial.
one thing about reject https://stackoverflow.com/a/52705433/2721050 🙂
At the end of the vid I thought that my phone was ringing, lol
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?
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.
TypeError: animal.reject is not a function , i get this error after running npm install underscore -g
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.
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.
Great Video. I'm curious about the music used in this video.
Me: "why isn't he writing arrow function? 🤔"
Me: "ooohhhhhh 😱"
Me: "but why are you looking like a redneck? 🤔"
Me: "ohhhhh 😱"
What's the font used in the editor?
return animal.species === 'dogs' is null or empty object as there are no "dogs" in animals object, only two "dog"
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!
a => a.species === 'dog'
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!
1:50 that was a good one haha
I like how your hands were everywhere. I found the video entertaining and educating at the same time.
Nice job!
I'm learning React, and these lessons are going to help a lot.
Tack så jätte mycket Mattias!!
I found a new dev mentor online.. watching every video