In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. (WIKI)

Do you understand anything of it ? If not then I think we are then same! I also don’t understanding anything when I first read this meaning. What is mutable data ? or what is the meaning of this? Why it even used ?Let’s start will what is a mutable data ?

Mutable data means you can change this data. Like – suppose we’ve a variable a=5 and in later we change the value and put 10 in a by a=10.

But In functional programming, we don’t use mutable data. Instead we use immutable data. We can’t change a data after we declare it. In JavaScript we use – const for declare immutable data, which you can’t change!

Now do you know why we use functional programming ? Let me tell you the reasons

  • Improve modularity
  • Less code code redundancy
  • More easier to solve complex problems
  • More maintainable
  • More Efficiency & some more

If you are using JS and used features like map or reduce. Do you know one thing?

You’re already using the functional programming!

Do you like today’s topic ?

Leave a Reply

Your email address will not be published. Required fields are marked *