export function factorial(n) {
  let result = 1;
  for (let i = n; i > 1; i--) {
    result *= i;
  }
  return result;
}

export function factorialRecursive(n) {
  if (n < 2) {
    return 1;
  }

  return n * factorialRecursive(n - 1);
}

// --------------------------- TESTS ---------------------------------------

console.time("factorial time: ");
factorial(1000);
console.timeLog("factorial time: ");

console.time("recursive factorial time: ");
factorialRecursive(1000);
console.timeLog("recursive factorial time: ");
