Need help - Smallest Common Multiple

Need help - Smallest Common Multiple
0

#1

hello, I need help in this challenge “Smallest Common Multiple”.
this code is working fine with all numbers that are less than 13. but when trying 13 or bigger number, it says “RangeError: Potential infinite loop.”. can anyone know why?


#2

FCC uses an infinite loop protection to keep your browser from crashing. If the code runs for longer than a set amount of time, it stops execution and warns you about the potential loop. FCC does provide a way to turn the loop protection off, but I advise against it. All of the challenges on FCC can be solved in a way that finishes before it times out.


#3

After the following runs, maxNum = 72,681,840 for the smallestCommons([18,23]). So by the time your next set of nested for loops completes, there have been 436,091,040 iterations. That many iterations takes longer than the FCC tests allow. This can be solved with out going through that many iterations.


#4

@ArielLeslie @RandellDawson okay, thank you.