Smallest Common Multiple[Help]

Tell us what’s happening:
This code works fine in other IDE but not in FCC, Why?

Your code so far

function smallestCommons(arr) {
  let num=1;
    let confirm=1;
    for(let start=Math.min(...arr),end=Math.max(...arr);start<=end;start++){
    // console.log(num)
      return num;


Your browser information:

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

Link to the challenge:

In what way does it not work? How is it behaving differently than you expect it to? What different things have you tried?

This code works only when the maximum of the input range is below 12.

For example, function calls such as smallestCommons( [1,4]), smallestCommons( [3,10]), smallestCommons( [5,12]) gives expected results.

But smallestCommons( [1,13]), smallestCommons( [13,10]) doesn’t return any value at all.

Sounds like you’re probably timing out. FCC uses infinite loop protection to keep your browser from crashing. It will stop your code from executing if it takes too long. Sometimes if your code is inefficient it will set off the ininite loop protection even if it’s not actually infinite.