DEV Community

Discussion on: Classes are just a fancy way of writing higher order functions

Collapse
 
functional_js profile image
Functional Javascript

If you think of solving problems with an FP approach, you think in terms of a-b-c.

//a. pure data
const person = {
  first: "Ernest",
  last: "Hemingway",
};
//b. pure func
const concatTwoWords = (s1, s2) => `${s1} ${s2}`;
//c. apply pure func to pure data
const fullName = concatTwoWords(person.first, person.last);