When a function returns a new object each time it is called, even with the same inputs, is it considered a pure function?

  • Yes
  • No
  • Depends on the type of object
  • Only if the object is immutable
A pure function should consistently return the same result for the same inputs, and creating new objects introduces unpredictability, making it impure.
Add your answer
Loading...

Leave a comment

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