If we use the value from Math.PI then this is indeed pure but I said in the example that PI is a global variable and defined outside the function.
A function is reusable and the value of PI will depend on the context. One may choose to define PI = 3.14159 instead of 3.14 and the result will vary.
Bdw my point was simply to say that don't use a global variable that might change. Thank you for your suggestion.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If we use the value from Math.PI then this is indeed pure but I said in the example that PI is a global variable and defined outside the function.
A function is reusable and the value of PI will depend on the context. One may choose to define PI = 3.14159 instead of 3.14 and the result will vary.
Bdw my point was simply to say that don't use a global variable that might change. Thank you for your suggestion.