Replace Magic Literal

refactorgram

function potentialEnergy(mass, height) {
  return mass * 9.81 * height;
}

image/svg+xml

const STANDARD_GRAVITY = 9.81;
function potentialEnergy(mass, height) {
  return mass * STANDARD_GRAVITY * height;
}

aliases Replace Magic Number with Symbolic Constant