Having seen a lot of pure functions and how they have no side effects, what would be an example of an impure function, which is always been antagonized as unstable and major source of error?
For example an impure function that has a side effect on a variable outside of its own scope:
var count = 0;
function increaseCount(val) {
count += val;
}
Or a function that returns different values for the same input because it evaluates a variable that is not given as parameter:
var count = 0;
function getSomething() {
return count > 0;
}