Smallest Common Multiple(Not passing the last test)

My code return the same output as the last test but I can’t past the test.

function smallestCommons(arr) {
  arr = arr.sort((a,b) => a - b);
  let smallestCommon = 0;
  let multiple = arr[1];

  while (smallestCommon === 0) {
    for (let i = arr[0]; i <= arr[1]; i++) {
      if (multiple % i !== 0)
        break;
      
      if (i === arr[1])
        smallestCommon = multiple;
    }
    multiple += arr[1];
  }
  return smallestCommon;
}

If you are sure that your function produces the correct answers then you are probably tripping the infinite loop protection in the FCC environment. If a function loops excessively it is assumed that there is an infinite loop condition and your function is shut down prematurely.

You will have to come up with an algorithm that tests fewer possible candidates for smallest common. By starting with the larger number as multiple you have eliminated quite a few already.