Linear Interpolation

This is one of those math functions that's used everywhere. If I understand it correctly, it's to find an approximate point on a line when you're given two other points on the same line.

Many thanks to Josh Comeau for the code below. The algorithm is available in many places on the internet, but I don't know if I could implement it myself.

const normalize = (
  number,
  currentScaleMin,
  currentScaleMax,
  newScaleMin = 0,
  newScaleMax = 1
) => {
  const standardNormalization =
    (number - currentScaleMin) / (currentScaleMax - currentScaleMin);

  return (
    (newScaleMax - newScaleMin) * standardNormalization + newScaleMin
  );
};