8 Concepts to Make You Code Truly Pure Functions in JavaScript
As you would do in a functional programming language

Pure functions behave identically to mathematical functions and give you diverse benefits. It is considered to be one if it matches two conditions:
- Given the same arguments, the function always calculates and returns the same result.