Check out a free preview of the full Hardcore Functional Programming in JavaScript, v2 course

The "Composition is Dot Chaining" Lesson is part of the full, Hardcore Functional Programming in JavaScript, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Brian explains that composition and dot chaining are the same, and says that dot chaining is more ergonomic in JavaScript.


Transcript from the "Composition is Dot Chaining" Lesson

>> I wanna kinda talk about how a composition is dot chaining. It's the same thing. And so, if you're writing this thing on the left here, where we call toLowerCase, and split, map, and reverse, that actually ends up being much more ergonomic. And Java scripts are like Scala or JavaScript.

And so, I tend to favor that in my day to day. Sometimes this actually expresses the problem much nicer. So you can use compose there. But I want you all to see a compose and how it works and get a feel for it, because if you go pick up PureScript or Elm or Haskell, you're gonna run right smack into it.

[LAUGH] And we're gonna get a pipeline operator, apparently. Is that happening, is that real? We got a pipeline operator in JavaScript? It's the same thing as composition. So we'll have a third thing down here is pipeline. [LAUGH] But yes, these two are equivalent.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now