Smallest Common Multiple Among many numbers

a hint would be good

Your code so far


function smallestCommons(arr) {
let newArr = [];

for (let i = Math.min(arr[0], arr[1]); i <= Math.max(arr[0], arr[1]); i++) {
  newArr.unshift(i);
}
  
  let answer = newArr[0] * newArr[1];
     
     for (let i = 2; i < newArr.length; i++) {
  if (answer % newArr[i] == 0) {

  } else {
    answer *= newArr[i]
  }

  }

  return answer;

}


smallestCommons([1,5]);

Your browser information:

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

Challenge: Smallest Common Multiple

Link to the challenge:

Can you explain, in words, what you are trying to do inside your code?

Find the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters.

Perhaps I didn’t explain well. You described what the function is supposed to do. How are you trying to do that? I don’t understand what your code is doing.