Intermediate Algorithm Scripting: Smallest Common Multiple query

Tell us what’s happening:
while executing the following program it gives correct result for input [23,18] ie.6056820

but upon executing by the commented code beside the original i.e > by executing the loop backwards i get wrong answer = 2018940

can anyone pls explain why ?

Your code so far

function smallestCommons(arr) {
  let max = Math.max(...arr);
  console.log(max) ;
  let min = Math.min(...arr);
  console.log(min) ;
  let no = max ;
  for(let i = max;i>=min;i--){      //for(let i=min;i<=max;i++)
    
    if(no%i!=0){  
    no = no + max ;
    i=max ;   //i=min
    }
  }
return no ;

}
console.log(smallestCommons([23,18]));

Your browser information:

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

Challenge: Smallest Common Multiple

Link to the challenge:

Since u already got the sollution
I would recomend to read they will explain u the code and how it works