gcdDivisionBased = (a, b) => {
  let tmp = a;
  a = Math.max(a, b);
  b = Math.min(tmp, b);
  while (b !== 0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }

  return a;
}
Euclidean algorithm to calculate the Greatest Common Divisor (GCD)

@param Number
@param Number

@return Number