Abdo Amin
Sep 2, 2021

--

Hey @Maksim

Thank you for sharing your opinion! :)

I believe otherwise. I think if the function mutate an argument it is considered impure.

Just consider the scenario:

I gave the calculator ( 2 + 3 + 5 ) and it gave me back 8 instead of 10.

What happened? It did something "unpredictable".

The 4th example mutated the arguments. and did something "unpredictable". Therefore, I believe it is impure.

--

--

Abdo Amin
Abdo Amin

Written by Abdo Amin

I love React and anything that has JavaScript and frontend in it.

Responses (2)