Smallest Common Multiple Infinite Loop Protection

Tell us what’s happening:
I can’t beat the last two requirements due to the infinite loop protection. How do I beat the infinite loop protection?

Your code so far

function smallestCommons(arr) {
  let maxNum =  Math.min(arr[0],arr[1]);
  for(let i=Math.max(arr[0],arr[1]);i>Math.min(arr[0],arr[1]); i--){
    maxNum = maxNum*i;
  let difference = Math.abs(arr[0]-arr[1]);
  for(let j=Math.max(...arr);j<=maxNum;j++){
    let trueNum = 0;
      for(let k=Math.max(arr[0],arr[1]);k>Math.min(arr[0],arr[1]); k--){
        if(j%k == 0){
        if(trueNum == difference){
          return j;


Your browser information:

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

Link to the challenge:

Don’t brute force it and find a more efficient way.
Your code has two nested loops that check numbers one by one, but it is really not efficient. Maybe research a moment on smallest common multiple and you can get an idea on a different approach more efficient than this