What's the difference between Pure and Impure functions?

Impure functions: They may change the passed in arguments and their return value doesn't solely depend on the arguments i.e functions that return values that depends on random calls. This they may generate different return value on different function calls with the same passed in arguments.

const increment = (num) => {
  num += 1; // Mutates passed in argument
  return num * Math.random(); // Return doesn't depend solely on arguments
}

Pure functions: They are the opposite of Impure functions💁‍♂️. They don't mutate their arguments, their return value depends solely on the passed in arguments this they always return the same value for different calls with the same arguments.

const multiply = (num1, num2) => {
  return num1 * num2;
}