Tell us what’s happening:
Describe your issue in detail here.

I am trying to solve Euler problem 5, and the code works locally.
It solves the challenge locally but when trying to submit my solution to fcc the last test breaks because of a potential infinite loop.

locally the last test runs in about 1 to 4 seconds.

Your code so far

function smallestMult(n) {
let numbers = [];
let i = 1;
outerloop: while (numbers.length <= n) {
for (let j = 1; j <= n; j++) {
if(numbers.length == n){
break outerloop;
}
if (i % j == 0 && i != j) {
numbers.push(i)
} else {
i++
numbers = []
}
}
}
console.log(numbers[0])
return numbers[0]
}

Your browser information:

User Agent is: Chrome Challenge:Problem 5: Smallest multiple

From my experience anything taking longer than one second for single case may have problems with passing on site.

If you want small tip, without making many changes - consider what can be done to ensure each checked number is divisible by the largest required divisor in a given case.

I’ve tried to write explanation, but I couldn’t be sure it wasn’t spoiling something. Instead I’ll try to formulate it as a bit expanded questions.

First thing - what in each test case is the largest divisor, by which number have to be divisible?
How it can be ensured each candidate number is divisible by that largest divisor?

I am well aware of their stance. They take an even more extreme stance than me. Personally, I think it is important to solve the problem for yourself, but you are cheating yourself out of the opportunity to learn as a developer if you refuse to look at alternative approaches to solving the problem once you have created a solution yourself.

Note by the way, that their stance does not say anything about people who have all solved the problem looking at each other’s solutions. They are trying to avoid spoilers.

A strict policy of only using knowledege you created yourself is seen as a bad thing for professional developers.

In this case, you should look to number theory to greatly improve the performance of your algorithm. There are mathematical theorems that you can leverage to change the complexity class of this algorithm.