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.

--

--

--

Front-end web developer and graduate student from Microverse.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdo Amin

Abdo Amin

Front-end web developer and graduate student from Microverse.

More from Medium

Single Page Applications — Mixing a Rails backend with a JavaScript frontend

How JavaScript is used for the back-end ft. Node.js?

Introduction to the Fancy JavaScript Request

Introduction to the Fancy JavaScript Request

Industry Practices and Principles in Software Engineering & an Introduction to JavaScript