Functions Flashcards
1
Q
What is a pure function?
A
Given the same input, it always returns the same output.
It doesn’t produce any side effects.
2
Q
What is a side effect
A
A side effect refers to any application state change that is observable outside the called function other than its return value. This includes (but is not limited to) modifying global variables, changing input parameters, writing to databases, and interacting with the DOM.