Implementing Euclidian Algorithms using JavaScript

We are going to implement the Euclidean algorithms using JavaScript. The given code is very sufficient for 2 to 3 parameters. Does this code will help us while tacking with multiple number of paraments, it will effect computational cost or not?, the algorithm will be generalized or not?

const euclideanAlgorithm = (val1, val2) => {

  const val1Abs = Math.abs(val1);
  const val2Abs = Math.abs(val2);
  
  return val2Abs === 0 ? val1Abs :  euclideanAlgorithm (val2Abs, val1Abs % val2Abs)

};
console.log(euclideanAlgorithm(5,3));
document.write(euclideanAlgorithm(5,3));