New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: question 77 need clarification #369
Comments
To best of my knowledge, a pure function is something which will return same result for same inputs, more kind of mathematical formula, ! |
That's true, but it is not enough.
Update:
|
@RidgeA Yes, i agree. the above code now become not a pure function ! Thanks for the explaination. |
```js const sum = (a, b) => a + b // this is not a pure function, in some case, it could have side effects. ``` Lint to issue: lydiahallie#369 Need help: translate to english
```js const sum = (a, b) => a + b // this is not a pure function, in some case, it could have side effects. ``` Lint to issue: lydiahallie/javascript-questions#369 Need help: translate to english
```js const sum = (a, b) => a + b // this is not a pure function, in some case, it could have side effects. ``` Lint to issue: lydiahallie/javascript-questions#369 Need help: translate to english
Question: https://github.com/lydiahallie/javascript-questions/blob/master/README.md#77-is-this-a-pure-function
I could imagine a situation where the function won't be pure.
In this case,
sum
function will return3
, but all console.log are executed.Obviously, this is a corner case, but....
The text was updated successfully, but these errors were encountered: