↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

A Metaphorical Introduction to Functional JavaScript

Functional JavaScript is presented as an approach to writing JavaScript, not as an add-on. The post says it favors code that is more readable, flexible, and maintainable, and it frames FJS as a set of tradeoffs rather than an absolute rule set.

Reading notes
#

  • Functional JavaScript is described as a way to use functional programming in JavaScript.
  • The post says FJS has benefits and drawbacks like any approach.
  • Pure functions are explained as functions that do not change external state and return the same result for the same input.
  • An impure function is shown changing a variable outside the function.
  • Declarative programming is contrasted with imperative programming as focusing on what is needed rather than how to do every step.
  • A declarative array example uses map to create a new array instead of mutating the original.
  • Arrow functions are presented as a shorter syntax that fits FJS well.
  • Array prototype methods are highlighted as built-in tools for creating new arrays and chaining operations.
  • reduce is described as a powerful method for complex data merging and manipulation.
  • Higher-order functions are defined as functions that take other functions as arguments.
  • Currying is explained as returning functions until the final result is produced.
  • The post uses divideBy and performMultipleTimes as examples of passing functions around.
  • FJS is described as a style on a spectrum, not a strict binary.