Pure functions always return the same results when given the same inputs. Functional programming terminologyīefore you can become an FP expert, there is some jargon you need to understand: Pure functions Nonetheless, if you're relatively experienced with JavaScript, you've likely incorporated some functional programming concepts into your code, perhaps even without knowing it. FP has a steep learning curve, so don't expect to learn everything you need to know about it from one tutorial. However, functional code is often more condensed and easier to test although at first glance it may look unintelligible to newcomers. These days, OOP is much more widespread than FP. Code written with the principles of FP in mind is called functional code.Īnother programming paradigm that is more familiar to casual coders is object-oriented programming, or OOP, which takes advantage of application states and methods. Taking outside effects, or state changes that don't depend on function inputs, makes software behave more predictably, which is a major selling point for many FP coders.
Unlike procedures that depend on a local or global state, value outputs in FP depend only on the arguments passed to the function. Functional programming is a declarative paradigm because it relies on expressions and declarations rather than statements. Following the FP philosophy entails foregoing things like shared states, mutable data and side effects. What is functional programming?įunctional programming (FP) is a programming paradigm for developing software using functions.
If you're new to functional programming, this guide will get you up to speed. Developers of large applications now regularly incorporate its principles into their codebase. While the concept has been around for quite some time, functional programming finally came from out of obscurity to the forefront of the JavaScript community a few years ago.