But what is functional programming? I still don’t know. Wikipedia’s definition gives a clue, but it isn’t exactly beginner-friendly:
“functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.”
My takeaway is this: functional programming is all about scary math stuff. Haha, OK, maybe I understand a bit more than that. But I don’t know how to express what I understand yet, because it’s all very fuzzy.
- map() runs a provided function on every element of an array, creating a new array with the modified elements.
- filter() checks if each element in an array meets certain criteria and creates a new array containing the elements that passed the test.
- apply() calls a function with a given
thisvalue and an array of arguments.
The short descriptions above don’t really do those methods justice. They’re incredibly powerful once you start using them, and I highly recommend this tutorial for anyone who’s interested!
I wanted to write about what I learned today in detail because I feel like I absorbed a lot of information, but I don’t know how to explain any of it yet. It’s still percolating. Isn’t it interesting how confusion seems to be an integral part of the learning process? I’m still in that stage where I’m feeling really stupid, but I know it means I’m making progress because I’m tackling concepts that are beyond my comfort zone.