DEV Community

Discussion on: Class vs Function based programming simplified

Collapse
 
iamshadmirza profile image
Shad Mirza

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.