JavaScript is one of the coolest programming languages, simply because you can write software in a variety of different ways. We mostly live in an object-oriented world, but we are not locked into that paradigm. We can also take a functional programming approach.
This course lasts 1 hour and 35 minutes and is divided into 13 lessons in total. You’ll find that it’s a great resource that you’ll come back to often, so be sure to bookmark the parts that interest you.
Who is this FREE course for?
- Absolute beginners who want to become web developers
- Experienced developers who want to explore advanced topics
- Programming enthusiasts who love to learn something new and exciting
Follow, learn by doing
I encourage you aftake this course and you will learn All the most important features of functional programming with JavaScript.
To help, the Learn Functional Programming with JavaScript course GitHub repository contains the source code for each lesson as well as the completed example project that was created during the course.
1. What you will learn in this free JavaScript course
Watch the video lesson [0:00:00] ↗
By the end of this course, you will understand concepts such as:
- first-class functions
- immutability
- compositional functions
- curry
- how to work with the DOM functionally
Setting up
Watch the video lesson [0:01:53] ↗
Let’s prep our development area and get it ready for coding! In this lesson I will show you how.
To configure JavaScript and our working environment, we will use the following tools:
2. Basic concepts
First-class functions
Watch the video lesson [0:07:10] ↗
In JavaScript, functions are first-class objects. They are a data type that we can assign to variables, pass to other functions, and even return functions from within another function. It’s a powerful feature and is critical to functional programming.
Declarative programming
Watch the video lesson [0:12:53] ↗
Functional programming takes a declarative approach to writing code. It’s a common (and very trendy) way to write code. We will look at declarative programming and compare it to imperative programming in this lesson.
Pure and impure functions
Watch the video lesson [0:17:47] ↗
There are two types of functions in functional programming: pure and impure. You will learn the difference between the two in this lesson.
Immutability
Watch the video lesson [00:21:27] ↗
We usually work with immutable data in functional programming. It may seem like more work to program immutably and inefficiently to boot, but there are benefits to using immutable data. You will learn why in this lesson.
3. Build a functional project
Presentation of the composition
Watch the video lesson [00:27:18] ↗
A key aspect of functional programming is the concept of composition: composing multiple functions into one. You will learn about the two types of composition in this lesson.
Using composition
Watch the video lesson [00:34:28] ↗
Now that you know the composition types, we’ll compose multiple functions together to create an HTML element.
Curry features
Watch the video lesson [00:41:11] ↗
Curry may be a difficult concept to grasp at first, but it is extremely powerful and allows us to create partial functions.
Write a functional web app
Watch the video lesson [00:48:12] ↗
Most of the code we’ve written just creates helper functions. In this lesson, we’ll start writing application code to display messages on the page.
Event management
Watch the video lesson [00:56:53] ↗
Handling events in a functional way is not much different than the procedural way, except that we now take care of our event configuration functions. I’ll show you how to do it so you can complete our application in this lesson.
For further reading:
4. Working with arrays
Comprehension map()
Watch the video lesson [1:05:29] ↗
One of the most useful and underused operations in all of programming is the idea of a map, i.e. transforming one array into another array. I’ll show you how to do it with JavaScript map()
method.
Filter arrays
Watch the video lesson [1:16:11] ↗
It’s very common to want to filter an array into a smaller data set. In this lesson you will learn how with the filter()
method.
Reduction matrices
Watch the video lesson [1:22:18] ↗
THE reduce()
operation is very useful and you will learn how it works and how to apply it in this lesson.
For more insights into this topic, check out these two articles:
Conclusion
Watch the video lesson [1:32:15] ↗
Functional programming with JavaScript is a completely different paradigm than what we’re used to, and it requires rethinking how we approach common problems. Functional programming can be elegant and expressive, and with concepts like composition and currying, we have some pretty nifty ways to reuse code.