Top "Pure-function" questions

Is a function that calls Math.random() pure?

Is the following a pure function? function test(min,max) { return Math.random() * (max - min) + min; } My understanding is …

javascript function pure-function
Why props in React are read only?

The React documentation says: React is pretty flexible but it has a single strict rule: all React components must act …

reactjs pure-function
What is an example of an impure function in JavaScript

Having seen a lot of pure functions and how they have no side effects, what would be an example of …

javascript pure-function
Are idempotent functions the same as pure functions?

I read Wikipedia's explanation of idempotence. I know it means a function's output is determined by it's input. But I …

function idempotent pure-function
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: No side effects (i.e. only changes to …

javascript functional-programming language-lawyer pure-function