Functional programming in JavaScript

1 Review

Teachers: Mattias Petter Johansson

About: 3 hours, 21 lessons, Certificate of Completion

In this video series, I will teach you how to do functional programming in JavaScript. This course assumes you know about common programming features such as variables, arrays and basic functions. You'll learn about more complex subjects from an excited and interesting teacher who'll keep you on your toes the entire time! 

If you don't know what higher order functions, maps, reducing, promises, currying, closures, streams or factories are but you're familiar with JavaScript up until that point, this is the course for you! 

Read More


More Details

Course Description

In this video series, I will teach you how to do functional programming in JavaScript. This course assumes you know about common programming features such as variables, arrays and basic functions. You'll learn about more complex subjects from an excited and interesting teacher who'll keep you on your toes the entire time! 

If you don't know what higher order functions, maps, reducing, promises, currying, closures, streams or factories are but you're familiar with JavaScript up until that point, this is the course for you! 

In this course you will learn about:

  • Higher order functions 
  • Maps
  • Reduce
  • Closures
  • Promises
  • Currying
  • Recursion
  • Functors
  • Streams
  • Prototyping
  • Factory functions 
  • and Monad

License: CC BY

Curriculum

Module 1: Functional programming in JavaScript

Lesson 1: Higher-order functions
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.
Lesson 2: Map
In this second one, I show you how and when to use the higher-order function map, and why it is the best thing ever.
Lesson 3: Map: Resources
Lesson 4: Reduce basics
In this third one, I show you how *reduce* fits into your toolbox and a basic example of it's usage.
Lesson 5: Reduce basics: Resources
Lesson 6: Reduce advanced
In this fourth one, we spend a little bit more time on *reduce*.
Lesson 7: Closures
Lesson 8: Closures: Resources
Lesson 9: Currying
Currying is when a function, instead of taking all arguments at one time, takes the first one and returns a new function that takes the second one and returns a new function which takes the third one, and so forth, until all arguments have been fulfilled.
Lesson 10: Recursion
In this video, we are going to learn about recursion - what recursion is, how it works, and why it's useful.
Lesson 11: Promises
Promises are, just like callbacks, a way of dealing with things being asynchronous - when we don't know for certain in what order things will happen. But promises are more powerful than callbacks because they compose - you can combine promises and chain them, all kinds of cool stuff - I've showed you some in this video, but there is WAY more you'll be able to do when you get comfortable with promises.
Lesson 12: Promises: Resources
Lesson 13: Semicolons cannot save you!
By all means, use semicolons for consistency, or just because your team likes it that way because it’s more C-like, or frankly just because you like how it looks. But don’t buy into the religion that it absolves you from thinking about automatic semicolon insertion. The ASI is always there, and and you need to be always vigilant about it, no matter if you add semicolons or not.
Lesson 14: Functors
In the context of JavaScript, a functor is a function, that, given a value and another function, unwraps the values to get to its inner value(s), calls the given function with the inner value(s), wraps the returned values in a new structure, and returns that new structure.
Lesson 15: Functors: I was WRONG
A functor is an object that has a map method. Arrays in JavaScript implement map and are therefore functors. Promises, Streams and Trees often implement map in functional languages, and when they do, they are considered functors. The map method of the functor takes it’s own contents and transforms each of them using the transformation callback passed to map, and returns a new functor, which contains the structure as the first functor, but with the transformed values.
Lesson 16: Streams
A stream is a flow of values that will be arriving whenever they feel like. Streaming libraries mentioned in the video:
Lesson 17: Streams: Resources
Lesson 18: Prototypes
Lesson 19: Factory functions
Lesson 20: Monads
Monads is a type of Functor, so you need to know what a Functor is in order for this episode to make sense. Thankfully, there there is a FunFunFunction episode for that, and you can watch it here: So, what is a monad? Remember that a Functor is an object that implements *map*? Well, a monad is a more powerful functor that also implements *flatMap*.
Lesson 21: Monads: Resources

Reviews (1 Review)

Ari Haverinen January 29th, 2017

What You'll Learn

  1. Advanced Javascript

Requirements

  1. Basic understanding of JavaScript
  2. A text editor