Skip to content

A series of real examples demonstrating how Functional Programming can provide a better approach than Object Oriented Programmig

Notifications You must be signed in to change notification settings

N8-B/object-vs-functional-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

🔥 Object vs Functional Programming in JS 🔥

We will learn through real examples how Functional Programming can provide a better approach than Object Oriented Programming- in some situations that we are currently dealing with.

JavaScript and FP

In JavaScript we can choose to use either of the OOP or FP paradigms as much, or as little, as we like. So, what is Functional Programming in a nutshell?

  • Immutable Data

Immutable data cannot be changed once created, leading to much simpler development and easier reasoning of app state.

  • Pure functions

A pure function is a function that, given the same input, will always return the same output, does not have any observable side effects and does not rely on any external state.

All this is possible because in JavaScript functions are first-class citizens. This means functions are objects (of the type Object), and, therefore, can be assigned as the value of a variable. The ability to use higher-order functions -a function that takes a function as an argument or that returns a function as a result- makes JavaScript a suitable language for functional programming.

Now Let the fight begin:

  • First round
  • Second round
  • Third round

About

A series of real examples demonstrating how Functional Programming can provide a better approach than Object Oriented Programmig

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published