A pure function is a function which:

  • Given the same input, will always return the same output.
  • Produces no side effects.
  • Relies on no external mutable state.

  • References

https://medium.com/javascript-scene/master-the-javascript-interview-what-is-a-pure-function-d1c076bec976