Smallest Common Multiple code is fine but can't pass the test

Tell us what’s happening:
Actually my code solve all the test, but I dont know why can’t pass all of them in the problem.

Thanks for help.

Your code so far

function smallestCommons(arr) {
  let max= Math.max(...arr)
  let min=Math.min(...arr)
  let range=getRange(min,max);
  let mcm=getMcm(range)
  return mcm;

function getRange(min,max){
  let numbers=[];
  for(let i=min;i<=max;i++){
  console.log(numbers )
  return numbers 

function getMcm(arr){
  let biggest=arr[arr.length-1];
  let result=null;
  while (result===null) {
  return result;

function anyHaveModule(num,range){
  for(let i=0;i<range.length;i++){
    const divider=range[i];
    const module=num%divider
      return true


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:

Your code is probably not optimized and timing out test cases. There are a lot of questions answered with this problem in the forum. So I would search them first.

What @shimphillip, says. You’ll notice that the while loop is running anyHaveModule, and anyHaveModule runs a loop. So, the code is running a nested loop.

the test should evaluate that I am in timing out. But in this case the test wasn’t specific and clear at all.

And for the other hand, if you see, the code works for all cases; is just optimization.