Pure Functions: Does “No Side Effects” Imply “Always Same Output, Given Same Input”?

The two conditions that define a function as pure are as follows:

  1. No side effects (i.e. only changes to local scope are allowed)
  2. Always return the same output, given the same input

If the first condition is always true, are there any times the second condition is not true?

I.e. is it really only necessary with the first condition?

#javascript

1 Likes5.50 GEEK