To me, functional programming is all about composing (or combining) functions to create new functions.

A good example of this would be map and it's siblings filter and reduce.

Imperative

constvalues=[1,2,3]letsum=0for(constxofvalues){sum=sum+x}

Functional

constvalues=[1,2,3]constadd=(x,y)=>x+yletsum=values.reduce(add)

Instead of coding all the steps to create the sum, we told reduce to use the add function.

If we were using something like Ramda, we could even do this to create a new function:

import{reduce}from'ramda'constadd=(x,y)=>x+y// Here we are composing a new function `sum` from `reduce` and `add`.constsum=reduce(add)(0)constvalues=[1,2,3]sum(values)//=> 6

To be able to compose functions like this, you need to also create pure functions, curried functions and also have immutable data. Which is why functional programming can be tricky to learn. It's not difficult to learn, it just takes time to fully understand the why.

You know, everybody is like rxjs and mocha and Jasmine and mojiscript and asynchronous curry ketchup frameworks but to me they are just collections of 'helpers' from other people that I like to write myself most of the time. Functional programming to me is closely related to context free development and that means elimiting dependencies. If functional programming really insists on being a thing then don't clean up only the language but also the rest.